Disk: add --disk-show-unknown option

Ref: https://github.com/LinusDierheimer/fastfetch/issues/383#issuecomment-1376893128
This commit is contained in:
李通洲
2023-01-10 17:31:47 +08:00
parent af03c74fba
commit 7f97725d7f
7 changed files with 34 additions and 0 deletions
+1
View File
@@ -13,6 +13,7 @@ Features:
* Add `--list-data-paths` option which list search paths for presets and logos
* Add `Brightness` module support
* Add `Battery` module support for FreeBSD
* Add `--disk-show-unknown` option for Disk module
Logos:
* Raspbian (@IamNoRobot, #373)
+1
View File
@@ -320,6 +320,7 @@ static void defaultConfig(FFinstance* instance)
ffStrbufInitA(&instance->config.diskFolders, 0);
instance->config.diskShowRemovable = true;
instance->config.diskShowHidden = false;
instance->config.diskShowUnknown = false;
ffStrbufInitA(&instance->config.batteryDir, 0);
+25
View File
@@ -212,6 +212,31 @@
# Default is auto.
#--gl auto
# Disk option
# Sets if removable volume should be printed
# Must be either true or false
# Default is true.
#--disk-show-removable true
# Disk option
# Sets if hidden volume should be printed
# Must be either true or false
# Default is false.
#--disk-show-hidden false
# Disk option
# Sets if unknown (unable to detect sizes) volume should be printed
# Must be either true or false
# Default is false.
#--disk-show-unknown false
# Disk option
# A colon (semicolon on Windows) separated list of folder paths for the disk output
# This option override `--disk-show-*` options above
# Must be a string
# Default is "/:/home" ("C:\\;D:\\ ..." on Windows).
#--disk-folders /:/home
# Percentage output type option
# Applies to all modules that prints percentage values. Currently memory, swap, disk, battery and CPU usage are supported.
# Only works with default format ( without --module-format option ).
+1
View File
@@ -106,6 +106,7 @@ Module specific options:
--disk-folders <folders>: A colon (semicolon on Windows) separated list of folder paths for the disk output. Default is "/:/home" ("C:\\;D:\\ ..." on Windows)
--disk-show-removable <?value>: Set if removable volume should be printed. Default is true
--disk-show-hidden <?value>: Set if hidden volumes should be printed. Default is false
--disk-show-unknown <?value>: Set if unknown (unable to detect sizes) volumes should be printed. Default is false
--battery-dir <folder>: The directory where the battery folders are. Standard: /sys/class/power_supply/
--cpu-temp <?value>: Detect and display CPU temperature if supported. Default is false
--gpu-temp <?value>: Detect and display GPU temperature if supported. Default is false
+2
View File
@@ -1254,6 +1254,8 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
instance->config.diskShowRemovable = optionParseBoolean(value);
else if(strcasecmp(key, "--disk-show-hidden") == 0)
instance->config.diskShowHidden = optionParseBoolean(value);
else if(strcasecmp(key, "--disk-show-unknown") == 0)
instance->config.diskShowUnknown = optionParseBoolean(value);
else if(strcasecmp(key, "--battery-dir") == 0)
optionParseString(key, value, &instance->config.batteryDir);
else if(strcasecmp(key, "--separator-string") == 0)
+1
View File
@@ -180,6 +180,7 @@ typedef struct FFconfig
FFstrbuf diskFolders;
bool diskShowRemovable;
bool diskShowHidden;
bool diskShowUnknown;
FFstrbuf batteryDir;
+3
View File
@@ -135,6 +135,9 @@ static void printAutodetected(FFinstance* instance, const FFlist* disks)
if(disk->type == FF_DISK_TYPE_HIDDEN && !instance->config.diskShowHidden)
continue;
if(disk->bytesTotal == 0 && !instance->config.diskShowUnknown)
continue;
printDisk(instance, disk);
}
}