Migration: deprecate --gen-config conf

This commit is contained in:
李通洲
2023-10-26 16:34:38 +08:00
parent 8bdd410e97
commit e707cf8464
4 changed files with 18 additions and 9 deletions
+2 -1
View File
@@ -4,7 +4,8 @@ This release introduces a new option `--migrate-config`, which migrates old flag
Changes:
* `--pipe` and `--stat` are moved from `general` options to `display` options. This affects cjson configuration.
* With the introduction of `--migrate-config`, the old flag based config file is deprecated, and will be removed in the future
* With the introduction of `--migrate-config`, the old flag based config file is deprecated, and will be removed in 3.0.0 (next major version)
* Support of `--gen-config conf` is deprecated accordingly, and will be removed in 2.3.0 (next minor version)
Features:
* Quirks for MIPS platforms (CPU, Linux)
+2
View File
@@ -27,6 +27,8 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
With customization and speed being two competing goals, this project actually builds two executables:
<!-- TODO: Better JSONC config format introduction -->
* The main one is `fastfetch`, which can be very greatly configured via flags. These flags can be made persistent by modifying `$XDG_CONFIG_HOME/fastfetch/config.conf`. Use `fastfetch --gen-config conf` to generate one. To view the available options, run `fastfetch --help`.
* The second executable is called `flashfetch`, which is configured at compile time to eliminate any possible overhead. Configuration of it can be very easily done in [`src/flashfetch.c`](src/flashfetch.c).
+2 -2
View File
@@ -14,8 +14,8 @@ Informative options:
--print-config-system: Print the default system config
--print-config-user: Print the default user config
--print-structure: Print the default structure
--gen-config <?type>: Generate a sample config file in the default path. Param `type` can be `jsonc` or `conf`
--gen-config-force <?type>: Generate a sample config file in the default path. Overwrite the existing one
--gen-config <type>: Generate a sample config file in the default path. Param `type` can be `jsonc` or deprecated `conf`
--gen-config-force <type>: Generate a sample config file in the default path. Overwrite the existing one
General options:
--load-config <file>: Load a config file or preset (+)
+12 -6
View File
@@ -236,18 +236,24 @@ static bool parseConfigFile(FFdata* data, const char* path)
static void generateConfigFile(bool force, const char* type)
{
if (!type)
{
fputs("Error: the config type (`jsonc` or `conf`) must be specified\n", stderr);
exit(1);
}
FFstrbuf* filename = (FFstrbuf*) ffListGet(&instance.state.platform.configDirs, 0);
// Paths generated in `init.c/initConfigDirs` end with `/`
bool isJsonc = false;
if (type)
bool isJsonc = ffStrEqualsIgnCase(type, "jsonc");
if (!isJsonc)
{
if (ffStrEqualsIgnCase(type, "jsonc"))
isJsonc = true;
else if (!ffStrEqualsIgnCase(type, "conf"))
if (!ffStrEqualsIgnCase(type, "conf"))
{
fputs("config type can only be `jsonc` or `conf`\n", stderr);
fputs("Error: config type can only be `jsonc` or `conf`\n", stderr);
exit(1);
}
else
fputs("Warning: support of flag based config type `conf` is deprecated, and may be removed in the future\n", stderr);
}
ffStrbufAppendS(filename, isJsonc ? "fastfetch/config.jsonc" : "fastfetch/config.conf");