@@ -421,7 +421,8 @@ static bool parseJsoncFile(const char* path, bool strictJson)
421421 return true;
422422}
423423
424- static void generateConfigFile (bool force , const char * filePath )
424+
425+ static void generateConfigFile (bool force , const char * filePath , bool fullConfig )
425426{
426427 if (!filePath )
427428 {
@@ -435,9 +436,11 @@ static void generateConfigFile(bool force, const char* filePath)
435436
436437 if (!force && ffPathExists (instance .state .genConfigPath .chars , FF_PATHTYPE_ANY ))
437438 {
438- fprintf (stderr , "Error: file `%s` exists. Use `--gen-config-force` to overwrite\n" , instance .state .genConfigPath .chars );
439+ fprintf (stderr , "Error: file `%s` exists. Use `--gen-config%s -force` to overwrite\n" , instance .state .genConfigPath .chars , fullConfig ? "-full" : "" );
439440 exit (477 );
440441 }
442+
443+ instance .state .fullConfig = fullConfig ;
441444}
442445
443446static void optionParseConfigFile (FFdata * data , const char * key , const char * value )
@@ -599,9 +602,13 @@ static void parseCommand(FFdata* data, char* key, char* value)
599602 exit (0 );
600603 }
601604 else if (ffStrEqualsIgnCase (key , "--gen-config" ))
602- generateConfigFile (false, value );
605+ generateConfigFile (false, value , false );
603606 else if (ffStrEqualsIgnCase (key , "--gen-config-force" ))
604- generateConfigFile (true, value );
607+ generateConfigFile (true, value , false);
608+ else if (ffStrEqualsIgnCase (key , "--gen-config-full" ))
609+ generateConfigFile (false, value , true);
610+ else if (ffStrEqualsIgnCase (key , "--gen-config-full-force" ))
611+ generateConfigFile (true, value , true);
605612 else if (ffStrEqualsIgnCase (key , "-c" ) || ffStrEqualsIgnCase (key , "--load-config" ) || ffStrEqualsIgnCase (key , "--config" ))
606613 optionParseConfigFile (data , key , value );
607614 else if (ffStrEqualsIgnCase (key , "--format" ))
@@ -726,16 +733,21 @@ static void run(FFdata* data)
726733 ffFinish ();
727734}
728735
729- static void writeConfigFile (FFdata * data , const FFstrbuf * filename )
736+ static void writeConfigFile (FFdata * data )
730737{
738+ const FFstrbuf * filename = & instance .state .genConfigPath ;
739+
731740 yyjson_mut_doc * doc = yyjson_mut_doc_new (NULL );
732741 yyjson_mut_val * root = yyjson_mut_obj (doc );
733742 yyjson_mut_doc_set_root (doc , root );
734- yyjson_mut_obj_add_str (doc , root , "$schema" , "https://github.com/fastfetch-cli/fastfetch/raw/dev /doc/json_schema.json" );
743+ yyjson_mut_obj_add_str (doc , root , "$schema" , "https://github.com/fastfetch-cli/fastfetch/raw/master /doc/json_schema.json" );
735744
736- ffOptionsGenerateLogoJsonConfig (& instance .config .logo , doc );
737- ffOptionsGenerateDisplayJsonConfig (& instance .config .display , doc );
738- ffOptionsGenerateGeneralJsonConfig (& instance .config .general , doc );
745+ if (instance .state .fullConfig )
746+ {
747+ ffOptionsGenerateLogoJsonConfig (& instance .config .logo , doc );
748+ ffOptionsGenerateDisplayJsonConfig (& instance .config .display , doc );
749+ ffOptionsGenerateGeneralJsonConfig (& instance .config .general , doc );
750+ }
739751 ffMigrateCommandOptionToJsonc (data , doc );
740752
741753 if (ffStrbufEqualS (filename , "-" ))
@@ -780,7 +792,7 @@ int main(int argc, char** argv)
780792 if (__builtin_expect (instance .state .genConfigPath .length == 0 , true))
781793 run (& data );
782794 else
783- writeConfigFile (& data , & instance . state . genConfigPath );
795+ writeConfigFile (& data );
784796
785797 ffStrbufDestroy (& data .structure );
786798}
0 commit comments