@@ -90,14 +90,15 @@ static STRING_IF_ANDROID_APP_ELSE(void) version()
9090static STRING_IF_ANDROID_APP_ELSE (void ) help(bool invalid_opt = false )
9191{
9292 constexpr std::string_view help (R"( Usage: customfetch [OPTIONS]...
93- A command-line system information tool (or neofetch like program), which its focus point is customizability and performance
93+ A command-line, GUI app, android widget system information tool (or neofetch like program), which its focus point is customizability and performance.
9494
95- -n, --no-display Do not display the logo
96- -N, --no-color Do not output and parse colors. Useful for stdout or pipe operations
97- --enable-colors Inverse of --no-color
95+ NOTE: Arguments that takes [<bool>] values, the values can be either: true, 1, enable or leave it empty. Any other value will be treated as false.
96+
97+ -n, --no-logo [<bool>] Do not display the logo
98+ -N, --no-color [<bool>] Do not output and parse colors. Useful for stdout or pipe operations
9899 -s, --source-path <path> Path to the ascii art or image file to display
99100 -C, --config <path> Path to the config file to use
100- -a, --ascii-logo-type [<name >]
101+ -a, --ascii-logo-type [<type >]
101102 The type of ASCII art to apply ("small" or "old").
102103 Basically will add "_<type>" to the logo filename.
103104 It will return the regular linux ascii art if it doesn't exist.
@@ -112,30 +113,30 @@ A command-line system information tool (or neofetch like program), which its foc
112113 Right now only 'kitty' and 'viu' are supported
113114 It's recommended to use GUI mode for the moment if something doesn't work
114115
115- -m, --layout-line Will replace the config layout, with a layout you specify in the arguments
116+ -m, --layout-line <string> Will replace the config layout, with a layout you specify in the arguments
116117 Example: `customfetch -m "${auto}OS: $<os.name>" -m "${auto}CPU: $<cpu.cpu>"`
117118 Will only print the logo (if not disabled), along side the parsed OS and CPU
118119
119120 -g, --gui Use GUI mode instead of printing in the terminal (use --version to check if it was enabled)
120121 -p, --logo-position <value> Position of the logo ("top" or "left" or "bottom")
121122 -o, --offset <num> Offset between the ascii art and the layout
122123 -l. --list-modules Print the list of the modules and its members
124+ -L, --logo-only [<bool>] Print only the logo
123125 -h, --help Print this help menu
124- -L, --logo-only Print only the logo
125126 -V, --version Print the version along with the git branch it was built
126127
127128 --bg-image <path> Path to image to be used in the background in GUI (put "disable" for disabling in the config)
128- --wrap-lines [<0,1 >] Disable (0) or Enable (1) wrapping lines when printing in terminal
129+ --wrap-lines [<bool >] Wrap lines when printing in terminal
129130 --logo-padding-top <num> Padding of the logo from the top
130131 --logo-padding-left <num> Padding of the logo from the left
131132 --layout-padding-top <num> Padding of the layout from the top
132- --title-sep <string> A char (or string) to use in $<builtin.title_sep>
133- --sep-reset <string> A separator (or string) that when encountered, will automatically reset color
134- --sep-reset-after [<0,1 >] Reset color either before (0) or after (1) 'sep-reset'
133+ --title-sep <string> A character (or string) to use in $<builtin.title_sep>
134+ --sep-reset <string> A character (or string) that when encountered, will automatically reset color
135+ --sep-reset-after [<bool >] Reset color either before or after 'sep-reset'
135136 --gen-config [<path>] Generate default config file to config folder (if path, it will generate to the path)
136137 Will ask for confirmation if file exists already
137138
138- --color <string> Replace instances of a color with another value.
139+ --add- color <string> Replace instances of a color with another value.
139140 Syntax MUST be "name=value" with no space between "=", example: --color "foo=#444333".
140141 Thus replaces any instance of foo with #444333. Can be done with multiple colors separately.
141142
@@ -345,6 +346,14 @@ system
345346
346347}
347348
349+ static bool str_to_bool (const std::string_view str)
350+ {
351+ if (str == " true" || str == " 1" || str == " enable" )
352+ return true ;
353+
354+ return false ;
355+ }
356+
348357// clang-format off
349358// parseargs() but only for parsing the user config path trough args
350359// and so we can directly construct Config
@@ -387,11 +396,11 @@ static STRING_IF_ANDROID_APP_ELSE(bool) parseargs(int argc, char* argv[], Config
387396 static const struct option opts[] = {
388397 {" version" , no_argument, 0 , ' V' },
389398 {" help" , no_argument, 0 , ' h' },
390- {" no-display" , no_argument, 0 , ' n' },
391399 {" list-modules" , no_argument, 0 , ' l' },
392- {" logo-only" , no_argument, 0 , ' L' },
393400 {" gui" , no_argument, 0 , ' g' },
394- {" no-color" , no_argument, 0 , ' N' },
401+ {" logo-only" , optional_argument, 0 , ' L' },
402+ {" no-logo" , optional_argument, 0 , ' n' },
403+ {" no-color" , optional_argument, 0 , ' N' },
395404 {" ascii-logo-type" , optional_argument, 0 , ' a' },
396405 {" offset" , required_argument, 0 , ' o' },
397406 {" font" , required_argument, 0 , ' f' },
@@ -402,18 +411,17 @@ static STRING_IF_ANDROID_APP_ELSE(bool) parseargs(int argc, char* argv[], Config
402411 {" distro" , required_argument, 0 , ' d' },
403412 {" source-path" , required_argument, 0 , ' s' },
404413 {" image-backend" , required_argument, 0 , ' i' },
405-
406- {" enable-colors " , no_argument, 0 , " enable-colors " _fnv1a16},
414+
415+ {" sep-reset-after " , optional_argument, 0 , " sep-reset-after " _fnv1a16},
407416 {" wrap-lines" , optional_argument, 0 , " wrap-lines" _fnv1a16},
417+ {" gen-config" , optional_argument, 0 , " gen-config" _fnv1a16},
408418 {" sep-reset" , required_argument, 0 , " sep-reset" _fnv1a16},
409419 {" title-sep" , required_argument, 0 , " title-sep" _fnv1a16},
410- {" sep-reset-after" , optional_argument, 0 , " sep-reset-after" _fnv1a16},
411420 {" logo-padding-top" , required_argument, 0 , " logo-padding-top" _fnv1a16},
412421 {" logo-padding-left" , required_argument, 0 , " logo-padding-left" _fnv1a16},
413422 {" layout-padding-top" , required_argument, 0 , " layout-padding-top" _fnv1a16},
414423 {" bg-image" , required_argument, 0 , " bg-image" _fnv1a16},
415- {" color" , required_argument, 0 , " color" _fnv1a16},
416- {" gen-config" , optional_argument, 0 , " gen-config" _fnv1a16},
424+ {" add-color" , required_argument, 0 , " add-color" _fnv1a16},
417425
418426 {0 ,0 ,0 ,0 }
419427 };
@@ -435,12 +443,8 @@ static STRING_IF_ANDROID_APP_ELSE(bool) parseargs(int argc, char* argv[], Config
435443 RETURN_IF_ANDROID_APP help (); break ;
436444 case ' l' :
437445 RETURN_IF_ANDROID_APP modules_list (); break ;
438- case ' n' :
439- config.m_disable_source = true ; break ;
440446 case ' f' :
441447 config.font = optarg; break ;
442- case ' L' :
443- config.m_print_logo_only = true ; break ;
444448 case ' g' :
445449 config.gui = true ; break ;
446450 case ' o' :
@@ -460,13 +464,29 @@ static STRING_IF_ANDROID_APP_ELSE(bool) parseargs(int argc, char* argv[], Config
460464 case ' i' :
461465 config.m_image_backend = optarg; break ;
462466 case ' N' :
463- config.m_disable_colors = true ; break ;
467+ if (OPTIONAL_ARGUMENT_IS_PRESENT)
468+ config.m_disable_colors = str_to_bool (optarg);
469+ else
470+ config.m_disable_colors = true ;
471+ break ;
464472 case ' a' :
465473 if (OPTIONAL_ARGUMENT_IS_PRESENT)
466474 config.ascii_logo_type = optarg;
467475 else
468476 config.ascii_logo_type .clear ();
469477 break ;
478+ case ' n' :
479+ if (OPTIONAL_ARGUMENT_IS_PRESENT)
480+ config.m_disable_source = str_to_bool (optarg);
481+ else
482+ config.m_disable_source = true ;
483+ break ;
484+ case ' L' :
485+ if (OPTIONAL_ARGUMENT_IS_PRESENT)
486+ config.m_print_logo_only = str_to_bool (optarg);
487+ else
488+ config.m_print_logo_only = true ;
489+ break ;
470490
471491 case " logo-padding-top" _fnv1a16:
472492 config.logo_padding_top = std::stoi (optarg); break ;
@@ -482,12 +502,12 @@ static STRING_IF_ANDROID_APP_ELSE(bool) parseargs(int argc, char* argv[], Config
482502
483503 case " wrap-lines" _fnv1a16:
484504 if (OPTIONAL_ARGUMENT_IS_PRESENT)
485- config.wrap_lines = static_cast < bool >( std::stoi ( optarg) );
505+ config.wrap_lines = str_to_bool ( optarg);
486506 else
487507 config.wrap_lines = true ;
488508 break ;
489509
490- case " color" _fnv1a16:
510+ case " add- color" _fnv1a16:
491511 config.addAliasColors (optarg); break ;
492512
493513 case " gen-config" _fnv1a16:
@@ -508,7 +528,7 @@ static STRING_IF_ANDROID_APP_ELSE(bool) parseargs(int argc, char* argv[], Config
508528
509529 case " sep-reset-after" _fnv1a16:
510530 if (OPTIONAL_ARGUMENT_IS_PRESENT)
511- config.sep_reset_after = static_cast < bool >( std::stoi ( optarg) );
531+ config.sep_reset_after = str_to_bool ( optarg);
512532 else
513533 config.sep_reset_after = true ;
514534 break ;
0 commit comments