diff --git a/completions/bash b/completions/bash index 783ddefe0..f22266f38 100644 --- a/completions/bash +++ b/completions/bash @@ -227,8 +227,6 @@ __fastfetch_completion() "--separator" "-s" "--structure" - "--set" - "--set-keyless" "--player-name" "--percent-type" "--publicip-url" diff --git a/src/common/commandoption.c b/src/common/commandoption.c index d1824d0fc..3d9c93742 100644 --- a/src/common/commandoption.c +++ b/src/common/commandoption.c @@ -79,29 +79,10 @@ static void genJsonResult(FFModuleBaseInfo* baseInfo, yyjson_mut_doc* doc) static void parseStructureCommand( const char* line, - FFlist* customValues, void (*fn)(FFModuleBaseInfo *baseInfo, yyjson_mut_doc* jsonDoc), yyjson_mut_doc* jsonDoc ) { - // handle `--set` and `--set-keyless` - FF_LIST_FOR_EACH(FFCustomValue, customValue, *customValues) - { - if (ffStrbufEqualS(&customValue->key, line)) - { - __attribute__((__cleanup__(ffDestroyCustomOptions))) FFCustomOptions options; - ffInitCustomOptions(&options); - if (customValue->printKey) - ffStrbufAppend(&options.moduleArgs.key, &customValue->key); - ffStrbufAppend(&options.moduleArgs.outputFormat, &customValue->value); - if (__builtin_expect(jsonDoc != NULL, false)) - fn((FFModuleBaseInfo*) &options, jsonDoc); - else - ffPrintCustom(&options); - return; - } - } - if(ffCharIsEnglishAlphabet(line[0])) { for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules) @@ -134,7 +115,7 @@ void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc) if(instance.config.display.stat) ms = ffTimeGetTick(); - parseStructureCommand(data->structure.chars + startIndex, &data->customValues, genJsonResult, jsonDoc); + parseStructureCommand(data->structure.chars + startIndex, genJsonResult, jsonDoc); if(instance.config.display.stat) { @@ -177,7 +158,7 @@ void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc) uint32_t colonIndex = ffStrbufNextIndexC(&data->structure, startIndex, ':'); data->structure.chars[colonIndex] = '\0'; - parseStructureCommand(data->structure.chars + startIndex, &data->customValues, genJsonConfig, jsonDoc); + parseStructureCommand(data->structure.chars + startIndex, genJsonConfig, jsonDoc); startIndex = colonIndex + 1; } diff --git a/src/common/commandoption.h b/src/common/commandoption.h index 1736a4f12..f8cf12044 100644 --- a/src/common/commandoption.h +++ b/src/common/commandoption.h @@ -2,18 +2,10 @@ #include "fastfetch.h" -typedef struct FFCustomValue -{ - bool printKey; - FFstrbuf key; - FFstrbuf value; -} FFCustomValue; - // Things only needed by fastfetch typedef struct FFdata { FFstrbuf structure; - FFlist customValues; // List of FFCustomValue bool configLoaded; } FFdata; diff --git a/src/common/option.h b/src/common/option.h index a76c9e623..e7dba9b22 100644 --- a/src/common/option.h +++ b/src/common/option.h @@ -50,6 +50,7 @@ typedef struct FFModuleArgs FFstrbuf key; FFstrbuf keyColor; FFstrbuf outputFormat; + FFstrbuf outputColor; uint32_t keyWidth; } FFModuleArgs; diff --git a/src/data/help.json b/src/data/help.json index 2e2538e4f..aba92b334 100644 --- a/src/data/help.json +++ b/src/data/help.json @@ -481,22 +481,6 @@ "default": ": " } }, - { - "long": "set", - "desc": "Hard set the value of a key", - "remark": "Deprecated. Use \"Custom\" module instead", - "arg": { - "type": "key=value" - } - }, - { - "long": "set-keyless", - "desc": "Hard set the value of a key, but don't print the key or the separator", - "remark": "Deprecated. Use \"Custom\" module instead", - "arg": { - "type": "key=value" - } - }, { "long": "show-errors", "desc": "Print occurring errors", diff --git a/src/fastfetch.c b/src/fastfetch.c index a57b0a3f4..4283fd56a 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -695,38 +695,7 @@ static void parseCommand(FFdata* data, char* key, char* value) static void parseOption(FFdata* data, const char* key, const char* value) { - if(ffStrEqualsIgnCase(key, "--set") || ffStrEqualsIgnCase(key, "--set-keyless")) - { - FF_STRBUF_AUTO_DESTROY customValueStr = ffStrbufCreate(); - ffOptionParseString(key, value, &customValueStr); - uint32_t index = ffStrbufFirstIndexC(&customValueStr, '='); - if(index == 0 || index == customValueStr.length) - { - fprintf(stderr, "Error: usage: %s =\n", key); - exit(477); - } - - FF_STRBUF_AUTO_DESTROY customKey = ffStrbufCreateNS(index, customValueStr.chars); - - FFCustomValue* customValue = NULL; - FF_LIST_FOR_EACH(FFCustomValue, x, data->customValues) - { - if(ffStrbufEqual(&x->key, &customKey)) - { - ffStrbufDestroy(&x->key); - ffStrbufDestroy(&x->value); - customValue = x; - break; - } - } - if(!customValue) customValue = (FFCustomValue*) ffListAdd(&data->customValues); - ffStrbufInitMove(&customValue->key, &customKey); - ffStrbufSubstrAfter(&customValueStr, index); - ffStrbufInitMove(&customValue->value, &customValueStr); - customValue->printKey = key[5] == '\0'; - } - - else if(ffStrEqualsIgnCase(key, "-s") || ffStrEqualsIgnCase(key, "--structure")) + if(ffStrEqualsIgnCase(key, "-s") || ffStrEqualsIgnCase(key, "--structure")) ffOptionParseString(key, value, &data->structure); else if( @@ -868,7 +837,6 @@ int main(int argc, char** argv) //Data stores things only needed for the configuration of fastfetch FFdata data = { .structure = ffStrbufCreate(), - .customValues = ffListCreate(sizeof(FFCustomValue)), .configLoaded = false, }; @@ -883,10 +851,4 @@ int main(int argc, char** argv) writeConfigFile(&data, &instance.state.genConfigPath); ffStrbufDestroy(&data.structure); - FF_LIST_FOR_EACH(FFCustomValue, customValue, data.customValues) - { - ffStrbufDestroy(&customValue->key); - ffStrbufDestroy(&customValue->value); - } - ffListDestroy(&data.customValues); }