1515#include <ctype.h>
1616#include <string.h>
1717
18+ FF_A_COLD
1819static void printCommandFormatHelpJson (void ) {
1920 yyjson_mut_doc * doc = yyjson_mut_doc_new (NULL );
2021 yyjson_mut_val * root = yyjson_mut_obj (doc );
@@ -49,6 +50,7 @@ static void printCommandFormatHelpJson(void) {
4950 yyjson_mut_doc_free (doc );
5051}
5152
53+ FF_A_COLD
5254static void printCommandFormatHelp (const char * command ) {
5355 FF_STRBUF_AUTO_DESTROY type = ffStrbufCreateNS ((uint32_t ) (strlen (command ) - strlen ("-format" )), command );
5456 ffStrbufLowerCase (& type );
@@ -85,6 +87,7 @@ static void printCommandFormatHelp(const char* command) {
8587 fprintf (stderr , "Error: Module '%s' is not supported\n" , type .chars );
8688}
8789
90+ FF_A_COLD
8891static void printFullHelp () {
8992 fputs ("Fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way\n\n" , stdout );
9093 if (!instance .config .display .pipe ) {
@@ -191,6 +194,7 @@ For detailed information on logo options, module configuration, and formatting,
191194 https://github.com/fastfetch-cli/fastfetch/wiki/Configuration" );
192195}
193196
197+ FF_A_COLD
194198static bool printSpecificCommandHelp (const char * command ) {
195199 yyjson_doc * doc = yyjson_read (FASTFETCH_DATATEXT_JSON_HELP , strlen (FASTFETCH_DATATEXT_JSON_HELP ), YYJSON_READ_NOFLAG );
196200 assert (doc );
@@ -301,6 +305,7 @@ static bool printSpecificCommandHelp(const char* command) {
301305 return false;
302306}
303307
308+ FF_A_COLD
304309static void printCommandHelp (const char * command ) {
305310 if (command == NULL ) {
306311 printFullHelp ();
@@ -313,6 +318,7 @@ static void printCommandHelp(const char* command) {
313318 }
314319}
315320
321+ FF_A_COLD
316322static void listAvailablePresets (bool pretty ) {
317323 FF_LIST_FOR_EACH (FFstrbuf , path , instance .state .platform .dataDirs ) {
318324 ffStrbufAppendS (path , "fastfetch/presets/" );
@@ -327,13 +333,15 @@ static void listAvailablePresets(bool pretty) {
327333 }
328334}
329335
336+ FF_A_COLD
330337static void listAvailableLogos (void ) {
331338 FF_LIST_FOR_EACH (FFstrbuf , path , instance .state .platform .dataDirs ) {
332339 ffStrbufAppendS (path , "fastfetch/logos/" );
333340 ffListFilesRecursively (path -> chars , true);
334341 }
335342}
336343
344+ FF_A_COLD
337345static void listConfigPaths (void ) {
338346 FF_LIST_FOR_EACH (FFstrbuf , folder , instance .state .platform .configDirs ) {
339347 bool exists = false;
@@ -345,13 +353,15 @@ static void listConfigPaths(void) {
345353 }
346354}
347355
356+ FF_A_COLD
348357static void listDataPaths (void ) {
349358 FF_LIST_FOR_EACH (FFstrbuf , folder , instance .state .platform .dataDirs ) {
350359 ffStrbufAppendS (folder , "fastfetch/" );
351360 puts (folder -> chars );
352361 }
353362}
354363
364+ FF_A_COLD
355365static void listModules (bool pretty ) {
356366 unsigned count = 0 ;
357367 for (int i = 0 ; i <= 'Z' - 'A' ; ++ i ) {
@@ -415,6 +425,7 @@ static bool parseJsoncFile(FFdata* data, const char* path, yyjson_read_flag flg)
415425 return true;
416426}
417427
428+ FF_A_COLD
418429static void generateConfigFile (FFdata * data , bool force , const char * filePath , bool fullConfig ) {
419430 if (data -> resultDoc ) {
420431 fprintf (stderr , "Error: duplicated `--gen-config` or `--format json` flags found\n" );
@@ -552,6 +563,7 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
552563 exit (414 );
553564}
554565
566+ FF_A_COLD
555567static void printVersion () {
556568 FFVersionResult * result = & ffVersionResult ;
557569 printf ("%s %s%s%s (%s)\n" , result -> projectName , result -> version , result -> versionTweak , result -> debugMode ? "-debug" : "" , result -> architecture );
@@ -572,8 +584,7 @@ static void parseCommand(FFdata* data, char* key, char* value) {
572584 if (ffStrEqualsIgnCase (key , "-h" ) || ffStrEqualsIgnCase (key , "--help" )) {
573585 printCommandHelp (value );
574586 exit (0 );
575- }
576- if (ffStrEqualsIgnCase (key , "--help-raw" )) {
587+ } else if (ffStrEqualsIgnCase (key , "--help-raw" )) {
577588 puts (FASTFETCH_DATATEXT_JSON_HELP );
578589 exit (0 );
579590 } else if (ffStrEqualsIgnCase (key , "-v" ) || ffStrEqualsIgnCase (key , "--version" )) {
@@ -792,6 +803,7 @@ static void run(FFdata* data) {
792803 }
793804}
794805
806+ FF_A_COLD
795807static void writeConfigFile (FFdata * data ) {
796808 const FFstrbuf * filename = & data -> genConfigPath ;
797809
0 commit comments