From 998193b0144f10cfc7077d84ed6752ebb41f8c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 16 Nov 2023 16:41:08 +0800 Subject: [PATCH] Fastfetch: support `-c none`; remove `--load-user-config` --- CHANGELOG.md | 10 +++++++--- completions/fish | 2 +- src/common/commandoption.h | 2 +- src/data/help.txt | 5 ++--- src/fastfetch.c | 28 ++++++++++++++++++---------- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12abd719c..ec35493d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ # 2.3.0 -Changes: +Config related changes: * The deprecated flag `--gen-config conf` is removed * Flag `--gen-config` now does the same thing as `--migrate-config`, which can be used as config migration and default config file generation. Flag `--migrate-config` is removed * Fastfetch now searchs for config files in the order of `fastfetch --list-config-paths`, and won't load other config if one is found. -* Flag `--load-user-config` now works in command line flags, but not in config file. +* The undocumented flag `--load-user-config` is removed. As an alternative, `--config none` can be used to disable loading config files. +* `--config` (previously named `--load-config`) is now supported for command line arguments only. If specified, other config files won't be loaded, which works like other programs. +* Config files will always be loaded before other command line flags being parsed. That is to say, command line flags will always override options defined in config files. + +We are deprecating flags based config files (will be removed in v3.0.0). We suggest you migrate to json based config files. Features: * Support Oils and elvish shell version detection (Shell) @@ -19,7 +23,7 @@ Bugfixes: * Fix terminal detection on NixOS (Terminal) # 2.2.2 -g + Changes: * `--percent-type` now defaults to 9 (colored percentage numbers) * `fastfetch` now prints LocalIp module by default diff --git a/completions/fish b/completions/fish index 1edf0a38c..d3177fa40 100755 --- a/completions/fish +++ b/completions/fish @@ -30,7 +30,7 @@ for line in (string match -- ' -*' $whole_text) set res $res -x -a "true\tBool false\tBool" case '' set -l presets (fastfetch --list-presets autocompletion)"\tPreset" - set res $res -r -a "$presets" + set res $res -r -a "none\tDisable $presets" case '' set res $res -F -r case '' diff --git a/src/common/commandoption.h b/src/common/commandoption.h index 276477b91..1736a4f12 100644 --- a/src/common/commandoption.h +++ b/src/common/commandoption.h @@ -14,7 +14,7 @@ typedef struct FFdata { FFstrbuf structure; FFlist customValues; // List of FFCustomValue - bool loadUserConfig; + bool configLoaded; } FFdata; bool ffParseModuleOptions(const char* key, const char* value); diff --git a/src/data/help.txt b/src/data/help.txt index c0069ca1d..5c6c45cd3 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -17,10 +17,9 @@ Informative options: --print-structure: Print the default structure Config options: - -c, --config : Load a config file or preset (+) + -c, --config : Specify the config file or preset to be loaded. If `none`, disable futher config loading (+) --gen-config : Generate a config file (or print it if is `-`), with options specified in the command line (if any) --gen-config-force : Generate a config file. Overwrite the existing one - --load-user-config : Set if user config should be loaded. Default is true if env-var `NO_CONFIG` is not set General options: --thread : Use separate threads to send HTTP requests @@ -184,4 +183,4 @@ Module specific options: 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. A (+) at the end indicates that more help can be printed with --help