From a03eaed4e295588f116f242ac524bf2f33c41a89 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Mon, 17 Oct 2022 17:35:06 +0200 Subject: [PATCH] Disk: add options# --- completions/bash | 2 ++ presets/verbose | 2 +- src/data/help.txt | 39 ++++++++++++++++--------------- src/detection/disk/disk_windows.c | 2 +- src/fastfetch.c | 19 +++++++++++---- 5 files changed, 38 insertions(+), 26 deletions(-) diff --git a/completions/bash b/completions/bash index a27172dfd..907f8c27f 100644 --- a/completions/bash +++ b/completions/bash @@ -188,6 +188,8 @@ __fastfetch_completion() "--pipe" "--title-fqdn" "--escape-bedrock" + "--disk-show-removable" + "--disk-show-hidden" ) local FF_OPTIONS_STRING=( diff --git a/presets/verbose b/presets/verbose index 9b7713eae..95512dc86 100644 --- a/presets/verbose +++ b/presets/verbose @@ -19,7 +19,7 @@ --cpu-usage-format Percentage: {} --gpu-format Vendor: {}; Name: {}; Driver: {}; Temperature: {}; CoreCount: {} --memory-format Used: {}; Total: {}; Percentage: {} ---disk-format Used: {}; Total: {}; Files: {}; Percentage: {} +--disk-format SizeUsed: {}; SizeTotal: {}; SizePercentage: {}; FilesUsed: {}; FilesTotal: {}; FilesPercentage: {}; Removable: {}; Hidden: {}; Filesystem: {} --battery-format Manufactor: {}; Model: {}; Technology: {}; Capacity: {}; Status: {} --poweradapter-format Watts: {}; Name: {}; Manufactor: {}; Model: {}; Description: {} --player-format Pretty: {}; Name: {}; Bus: {}; Url: {} diff --git a/src/data/help.txt b/src/data/help.txt index 181f24671..9d8c32027 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -87,25 +87,26 @@ Library options: Set the path of a library to load --lib-cjson Module specific options: - --title-fqdn : Sets if the title should use fully qualified domain name. Default is false. - --separator-string : Set the string printed by the separator module - --os-file : Set the path to the file containing OS informations - --disk-folders : A colon (semicolon on Windows) separated list of folder paths for the disk output. Default is "/:/home" ("C:\\;D:\\ ..." on Windows) - --disk-removable : Sets if removable volume should be printed. Default is false - --battery-dir : The directory where the battery folders are. Standard: /sys/class/power_supply/ - --cpu-temp : Detect and display CPU temperature if supported. Default is false - --gpu-temp : Detect and display GPU temperature if supported. Default is false - --battery-temp : Detect and display Battery temperature if supported. Default is false - --localip-show-ipv4 : Show ipv4 addresses in local ip module. Default is true - --localip-show-ipv6 : Show ipv6 addresses in local ip module. Default is false - --localip-show-loop : Show loop back addresses (127.0.0.1) in local ip module. Default is false - --localip-name-prefix : Show ips with given name prefix only. Default is empty - --public-ip-timeout: Time in milliseconds to wait for the public ip server to respond. Default is disabled (0) - --public-ip-url: The URL of public IP detection server to be used. - --weather-timeout: Time in milliseconds to wait for the weather server to respond. Default is disabled (0) - --weather-output-format: The output weather format to be used. It must be URI encoded. - --player-name: The name of the player to use - --gl : Sets the opengl context creation library to use. Must be auto, egl, glx or osmesa. Default is auto + --title-fqdn : Sets if the title should use fully qualified domain name. Default is false. + --separator-string : Set the string printed by the separator module + --os-file : Set the path to the file containing OS informations + --disk-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 : Sets if removable volume should be printed. Default is true. + --disk-show-hidden : Sets if hidden volumes should be printed. Default is false + --battery-dir : The directory where the battery folders are. Standard: /sys/class/power_supply/ + --cpu-temp : Detect and display CPU temperature if supported. Default is false + --gpu-temp : Detect and display GPU temperature if supported. Default is false + --battery-temp : Detect and display Battery temperature if supported. Default is false + --localip-show-ipv4 : Show ipv4 addresses in local ip module. Default is true + --localip-show-ipv6 : Show ipv6 addresses in local ip module. Default is false + --localip-show-loop : Show loop back addresses (127.0.0.1) in local ip module. Default is false + --localip-name-prefix : Show ips with given name prefix only. Default is empty + --public-ip-timeout: Time in milliseconds to wait for the public ip server to respond. Default is disabled (0) + --public-ip-url: The URL of public IP detection server to be used. + --weather-timeout: Time in milliseconds to wait for the weather server to respond. Default is disabled (0) + --weather-output-format: The output weather format to be used. It must be URI encoded. + --player-name: The name of the player to use + --gl : Sets the opengl context creation library to use. Must be auto, egl, glx or osmesa. Default is auto Parsing is not case sensitive. E.g. "--lib-PCI" is equal to "--Lib-Pci" If a value starts with a ?, it is optional. "true" will be used if not set. diff --git a/src/detection/disk/disk_windows.c b/src/detection/disk/disk_windows.c index b3c50456c..6f6908ca9 100644 --- a/src/detection/disk/disk_windows.c +++ b/src/detection/disk/disk_windows.c @@ -12,7 +12,7 @@ void ffDetectDisksImpl(FFDiskResult* disks) return; } - char* buff = malloc(length + 1); + char* buf = malloc(length + 1); GetLogicalDriveStringsA(length, buf); for(uint32_t i = 0; i < length; i++) diff --git a/src/fastfetch.c b/src/fastfetch.c index f395d808b..ea2818b96 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -300,11 +300,16 @@ static inline void printCommandHelp(const char* command) } else if(strcasecmp(command, "disk-format") == 0) { - constructAndPrintCommandHelpFormat("disk", "{}GiB / {}GiB ({4}%)", 4, - "Used size", - "Total size", - "Percentage used", - "Num files" + constructAndPrintCommandHelpFormat("disk", "{1} / {2} ({3}%)", 9, + "Size used", + "Size total", + "Size percentage", + "Files used", + "Files total", + "Files percentage", + "True if removable volume", + "True if hidden volume", + "Filesystem" ); } else if(strcasecmp(command, "battery-format") == 0) @@ -1314,6 +1319,10 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con instance->config.titleFQDN = optionParseBoolean(value); else if(strcasecmp(key, "--disk-folders") == 0) optionParseString(key, value, &instance->config.diskFolders); + else if(strcasecmp(key, "--disk-show-removable") == 0) + instance->config.diskShowRemovable = optionParseBoolean(value); + else if(strcasecmp(key, "--disk-show-hidden") == 0) + instance->config.diskShowHidden = optionParseBoolean(value); else if(strcasecmp(key, "--battery-dir") == 0) optionParseString(key, value, &instance->config.batteryDir); else if(strcasecmp(key, "--separator-string") == 0)