@@ -88,72 +88,81 @@ static void version()
8888static void help (bool invalid_opt = false )
8989{
9090 constexpr std::string_view help (
91- R"( Usage: customfetch [OPTIONS]...
92- A command-line, GUI app, android widget system information tool (or neofetch like program), which its focus point is customizability and performance.
93-
94- 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.
95-
96- -n, --no-logo Do not display the logo
97- -N, --no-color Do not output and parse colors. Useful for stdout or pipe operations
98- -L, --logo-only Print only the logo
99- -s, --source-path <path> Path to the ascii art or image file to display
100- -C, --config <path> Path to the config file to use
101- -a, --ascii-logo-type <type>
102- The type of ASCII art to apply ("small" or "old").
103- Basically will add "_<type>" to the logo filename.
104- It will return the regular OS ascii art if it doesn't exist.
105- Make it empty for regular.
106-
107- -D, --data-dir <path> Path to the data dir where we'll taking the distros ascii arts (must contain subdirectory called "ascii")
108- -d, --distro <name> Print a custom logo from the given `data-dir` (must be the same name, uppercase or lowercase, e.g "windows 11" or "ArCh")
109- -f, --font <name> The font to be used in the GUI app (syntax must be "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]" without the double quotes and [])
110- An example: [Liberation Mono] [Normal] [12], which can be "Liberation Mono Normal 12"
111-
112- -i, --image-backend <name> (EXPERIMENTAL) Image backend tool for displaying images in terminal.
113- Right now only 'kitty' and 'viu' are supported
114- It's recommended to use the GUI app for the moment if something doesn't work
115-
116- -m, --layout-line <string> Will replace the config layout, with a layout you specify in the arguments
117- Example: `customfetch -m "${auto}OS: $<os.name>" -m "${auto}CPU: $<cpu.cpu>"`
118- Will only print the logo (if not disabled), along side the parsed OS and CPU
119-
120- -O, --override <string> Overrides a config value, but NOT arrays.
121- Syntax must be "name=value" E.g "auto.disk.fmt='Disk(%1): %6'".
122- For convinience purpose, names that doesn't have a dot for telling the table, will automatically be considered under the [config] table
123- E.g "sep-reset-after=true" works as "config.sep-reset-after=true"
124-
125- -p, --logo-position <value> Position of the logo ("top" or "left" or "bottom")
126- -o, --offset <num> Offset between the ascii art and the layout
127- -l, --list-modules Print the list of the info tag modules and its members
128- --list-logos Print the sorted list of the ascii logos you can you use by the given `data-dir`
129- -h, --help Print this help menu
130- -w, --how-it-works Print how customfetch and the layout variable works
131- -V, --version Print the version along with the git branch it was built
132-
133- --loop-ms <num> Execute customfetch in a loop (live mode) every <num> milliseconds.
134- It won't parse the config every time and will you only notice RAM, uptime etc. changes
135- Put 0 or a <num> minor than 50 to disable and just print once.
136- Not availabile in the android widget app.
137-
138- --bg-image <path> Path to image to be used in the background in the GUI app (put "disable" for disabling in the config)
139- --wrap-lines [<bool>] Wrap lines when printing in terminal
140- --logo-padding-top <num> Padding of the logo from the top
141- --logo-padding-left <num> Padding of the logo from the left
142- --layout-padding-top <num> Padding of the layout from the top
143- --title-sep <string> A character (or string) to use in $<title_sep>
144- --sep-reset <string> A character (or string) that when encountered, will automatically reset color
145- --sep-reset-after [<bool>] Reset color either before or after 'sep-reset'
146- --gen-config [<path>] Generate default config file to config folder (if path, it will generate to the path)
147- Will ask for confirmation if file exists already
148-
149- --color <string> Replace instances of a color with another value.
150- Syntax MUST be "name=value" with no space between "=", example: --color "foo=#444333".
151- Thus replaces any instance of foo with #444333. Can be done with multiple colors separately.
91+ R"( Usage: customfetch [OPTIONS]...
92+ A command-line, GUI, and Android widget system information tool (like neofetch) focused on customizability and performance.
93+
94+ NOTE: Boolean flags [<BOOL>] accept: "true", 1, "enable", or empty. Any other value is treated as false.
95+
96+ GENERAL OPTIONS:
97+ -h, --help Print this help menu.
98+ -V, --version Print version and Git branch info.
99+ -C, --config <PATH> Path to the config file (default: ~/.config/customfetch.conf).
100+
101+ --gen-config [<PATH>] Generate default config file. If PATH is omitted, saves to default location.
102+ Prompts before overwriting.
103+
104+ LOGO OPTIONS:
105+ -n, --no-logo Disable logo display.
106+ -L, --logo-only Print only the logo (skip info layout).
107+ -s, --source-path <PATH> Path to custom ASCII art/image file.
108+
109+ -a, --ascii-logo-type <TYPE>
110+ Type of ASCII art (typically "small", "old", or empty for default).
111+ Example: "--ascii-logo-type small" looks for "logo_small.txt".
112+
113+ -D, --data-dir <PATH> Path to data directory containing "ascii/" subfolder with distro logos.
114+ -d, --distro <NAME> Use a custom distro logo (case-insensitive, e.g., "windows 11" or "ArCh").
115+ -p, --logo-position <POS> Logo position: "top" (default), "left", or "bottom".
116+ -o, --offset <NUM> Space between logo and layout (default: 5).
117+ --logo-padding-top <NUM> Logo padding from top (default: 0).
118+ --logo-padding-left <NUM> Logo padding from left (default: 0).
119+
120+ LAYOUT & FORMATTING:
121+ -m, --layout-line <STRING> Override config layout with custom line(s).
122+ Example: `-m "${auto}OS: $<os.name>" -m "${auto}CPU: $<cpu>"`.
123+
124+ -N, --no-color Disable all colors (useful for pipes/scripts).
125+ --wrap-lines=[<BOOL>] Enable line wrapping (default: false).
126+ --title-sep <STRING> String to use for $<title_sep> (default: "-").
127+ --sep-reset <STRING> String that resets color (default: ":").
128+ --sep-reset-after=[<BOOL>] Reset color after (default) or before 'sep-reset'.
129+
130+ GUI/TERMINAL OPTIONS:
131+ -f, --font <STRING> GUI font (format: "FAMILY STYLE SIZE", e.g., "Liberation Mono Normal 12").
132+ -i, --image-backend <NAME> (Experimental) Terminal image backend ("kitty" or "viu").
133+ --bg-image <PATH> GUI background image path ("disable" to turn off).
134+
135+ ADVANCED/CONFIG:
136+ -O, --override <STRING> Override a config value (non-array). Syntax: "name=value" (no spaces around "=").
137+ Example: "auto.disk.fmt='Disk(%1): %6'".
138+ Note: Names without dots (e.g., "sep-reset-after") gets mapped to "config.<name>".
139+
140+ --color <STRING> Replace a color globally. Syntax: "name=hex" (no spaces around "=").
141+ Example: "--color magenta=#FF00FF".
152142
153143 --allow-command-tag Allow bash command tags $() to be executed in the config or -m args.
154- This is a safety measure for preventing malicious code to be executed because you didn't want to check the config first
144+ This is a safety measure for preventing malicious code to be executed because you didn't want to check the config first.
155145
156- Read the manual "customfetch.1" or --how-it-works for more infos about customfetch and how it works
146+ INFORMATIONAL:
147+ -l, --list-modules List all available info tag modules (e.g., $<cpu> or $<os.name>).
148+ -w, --how-it-works Explain layout variables and customization.
149+ --list-logos List available ASCII logos in --data-dir.
150+
151+ LIVE MODE:
152+ --loop-ms <NUM> Run in live mode, updating every <NUM> milliseconds (min: 50).
153+ Use 0 to disable (default).
154+
155+ EXAMPLES:
156+ 1. Minimal output with default logo:
157+ customfetch --no-color
158+
159+ 2. Custom distro logo with live updates:
160+ customfetch --distro "arch" --loop-ms 1000
161+
162+ 3. Override layout and colors:
163+ customfetch -m "${auto}OS: $<os.name>" --color "magenta=#FF00FF"
164+
165+ For details, see `man customfetch` or run `--how-it-works`.
157166)" );
158167
159168 fmt::print (" {}\n " , help);
@@ -375,7 +384,8 @@ system
375384
376385)" );
377386
378- fmt::print (" {}\n " , list);
387+ fmt::print (" {}" , list);
388+ fmt::print (" \n " );
379389 std::exit (EXIT_SUCCESS);
380390}
381391
@@ -384,87 +394,119 @@ static void explain_how_this_works()
384394{
385395 constexpr std::string_view str (
386396R"(
387- customfetch is designed with customizability in mind
388- here is how it works:
389- the variable "layout" is used for showing the infos as like as the user want, no limitation.
390- inside here there are 5 "tags": $<> $() ${} $[] $%%
391-
392- The Info tag $<> lets you print the value of a member of a module.
393- e.g $<user.name> will print the username, $<os.kernel_version> will print the kernel version and so on.
394-
395- There are variants who you only need the module name,
396- such as $<ram> or $<title>
397- All the modules and their members are listed in the `--list-modules` argument
398-
399- The Bash command tag $() will execute bash commands and print the output.
400- e.g $(echo \"hello world\") will indeed echo out hello world.
401- you can even use pipes
402- e.g $(echo \"hello world\" | cut -d' ' -f2) will only print world
403-
404- The Conditional tag $[] is used to display different outputs based on the comparison.
405- syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse]
406- note: putting spaces between commas, could change the expected result
407-
408- Each part can have a tag or anything else.
409- e.g $[$<user.name>,$(echo $USER),the name is correct,the name is NOT correct]
410-
411- This is useful when on some terminal or WM the detection can be different than others
412- Or maybe even on holidays for printing special texts
413- e.g $[$(date +%d-%m),25-12,${red}Happy ${white}Christmas!,]
414-
415- The Color tag ${} is used for printing the text of a certain color.
416- e.g "${red}hello world" will indeed print "hello world" in red (or the color you set in the variable)
417- The colors can be predefined such as: black, red, green, blue, cyan, yellow, magenta, white.
418- They can be configured in the config file.
419-
420- They can have hex codes colors (e.g "#5522dd").
421- You can apply special effects to colors by using the following symbols before the '#' in hex codes:
422-
423- Terminal and GUI app GUI app only
424- * b - for background color. * o - for overline
425- * u - to underline the text * a(value) - for fg alpha (either a plain integer between 1 and 65536 or a percentage value like `50%`)
426- * ! - for bold text * L(value) - to underline the text with a style (`none`, `single`, `double`, `low`, `error`)
427- * i - for italic text * U(value) - for choosing the underline color (hexcode color)
428- * s - for strikethrough text * B(value) - for bg color text (hexcode color)
429- * S(value) - for strikethrough color (hexcode color)
430- Terminal Only * O(value) - for overline color (hexcode color)
431- * l - for blinking text * A(value) - for bg alpha (either a plain integer between 1 and 65536 or a percentage value like `50%`)
432- * w(value) - for specify font weight (`ultralight`, `light`, `normal`, `bold`, `ultrabold`, `heavy`, or a numeric weight)
433-
434- Alternatively, ANSI escape codes can be used, e.g ${\e[1;32m} or ${\e[38;2;34;255;11m}.
435-
436- To reset colors, use ${0} for a normal reset or ${1} for a bold reset.
437-
438- To use the colors that the ascii art logo uses, use ${auto} for getting the 1st color, ${auto4} for the 4th one and so on.
439- If you're using the GUI app and wants to display a custom source that's an image, all the auto colors will be the same colors as the distro ones
440-
441- The Percentage tag $%% is used for displaying the percentage between 2 numbers.\
442- It **Must** contain a comma for separating the 2. They can be either be taken from a tag or it put yourself.\
443- For example: $%50,100%
444- For inverting colors of bad and great (red and green), before the first '%' put '!'
445- without quotes ofc
446-
447- ################################################################
448- # Little FAQ
449- # Q: Why when I use & or < in the config or ASCII art, it won't work on the GUI app?
450- # A: replace "<" with "\\<" in the config, or "\<" in the ascii art. Same goes for &
451- # It won't affect the printing in terminal
452- #
453- # Q: I want to use `cbonsai` as ASCII art, how do I use it?
454- # A: First off, create a text file and there put only `$(!cbonsai -p)`
455- # Save the file and use `-s "/path/to/text/file"`.
456- # Use `--offset` (`-o`) for aligning and put it under the bonsai.
457- #
458- # Read the manual customfetch.1 for more infos with $() tag
459- #
460- # Q: Can I use recursive tags?
461- # A: If "$<disk($<disk($[1,1,$(echo -n $<disk(/).mountdir>),23]).mountdir>)>" works,
462- # Then I guess yeah
463- ################################################################
464-
397+ customfetch is designed for maximum customizability, allowing users to display system information exactly how they want it.
398+ The layout and logo is controlled through special tags that can output system info, execute commands, apply conditional logic, add colors, and calculate percentages with some colors.
399+
400+ Tag References:
401+ 1. Information Tag ($<>)
402+ Retrieves system information from modules.
403+
404+ Syntax: $<module.member> or $<module>
405+
406+ Examples:
407+ - $<user.name> # Displays login username
408+ - $<os.kernel> # Shows kernel version
409+ - $<ram> # Shows formatted RAM usage
410+
411+ Use `--list-modules` to see all available modules and members.
412+
413+ 2. Bash Command Tag ($())
414+ Executes shell commands and outputs the result.
415+
416+ Syntax: $(command)
417+
418+ Examples:
419+ - $(echo "hello") # Outputs: hello
420+ - $(date +%F) # Shows current date
421+ - $(uname -r | cut -d'-' -f1) # Shows kernel version number only
422+
423+ Supports full shell syntax including pipes and redirection.
424+
425+ 3. Conditional Tag ($[])
426+ Displays different outputs based on conditions.
427+
428+ Syntax: $[condition,comparison,true_output,false_output]
429+
430+ Examples:
431+ - $[$<user.name>,toni,Welcome back!,Access denied]
432+ - $[$(date +%m-%d),12-25,Merry Christmas!,]
433+ - $[$<os.name_id>,arch,${green}I use arch btw,${red}Non-arch user]
434+
435+ 4. Color Tag (${})
436+ Applies colors and text formatting.
437+
438+ Basic syntax: ${color} or ${modifiers#RRGGBB}
439+
440+ Color options:
441+ - Named colors from config
442+ - Hex colors: ${#ff00cc}
443+ - Special colors: ${auto} (uses logo colors)
444+ - Reset styles: ${0} (normal), ${1} (bold reset)
445+
446+ Formatting modifiers (prefix before color):
447+ - ! = Bold
448+ - u = Underline
449+ - i = Italic
450+ - s = Strikethrough
451+ - l = Blink (terminal only)
452+ - b = Background color
453+
454+ Advanced GUI-only modifiers:
455+ - o = Overline
456+ - a(value) = Foreground alpha (1-65536 or 0%-100%)
457+ - L(value) = Underline style (none/single/double/low/error)
458+ - U(color) = Underline color (hex)
459+ - B(color) = Background color (hex)
460+ - S(color) = Strikethrough color (hex)
461+ - O(color) = Overline color (hex)
462+ - A(value) = Background alpha (1-65536 or 0%-100%)
463+ - w(value) = Font weight (light/normal/bold/ultrabold or 100-1000)
464+
465+ Examples:
466+ GUI App only:
467+ ${oU(#ff0000)L(double)}Error # Double red underline
468+ ${a(50%)#00ff00}Semi-transparent green
469+ Cross-platform:
470+ ${\e[1;33m}Bold yellow
471+ ${b#222222}${white}White on gray
472+ ${auto3}The 3rd logo color
473+
474+ Notes:
475+ - customfetch will try to convert ANSI escape codes to GUI app equivalent
476+ - customfetch will ignore GUI-specific modifiers on terminal.
477+ - if you're using the GUI app and want to display a custom logo that's an image, all the auto colors will be the same colors as the distro ones.
478+
479+ 5. Percentage Tag ($%%)
480+ Calculates and displays colored percentages.
481+
482+ Syntax: $%value,total% or $%!value,total% (inverted colors)
483+
484+ Examples:
485+ - $%$<ram.used>,$<ram.total>%
486+ - $%!50,100% (shows red if low)
487+ - $%$(cat /sys/class/power_supply/BAT0/capacity),100%
488+
489+ Pro Tip:
490+ - Combine tags for powerful formatting:
491+ ${u#5522dd}$[$(date +%H),12,Good ${yellow}morning,Good ${#ff8800}afternoon]
492+
493+ FAQ:
494+ Q: Why do special characters (&, <) break the GUI display?
495+ A: Escape these characters with \\ (e.g replace "<" with "\\<" from both config and ASCII art):
496+ This doesn't affect terminal output.
497+
498+ Q: How can I use cbonsai as ASCII art?
499+ A: 1. Create a text file containing: $(!cbonsai -p)
500+ 2. Use: customfetch -s "/path/to/file.txt"
501+ 3. Adjust offset for proper alignment
502+
503+ Q: Does customfetch support nested tags?
504+ A: Yes! Complex nesting is supported, for example:
505+ $<disk($<disk($[1,1,$(echo -n $<disk(/).mountdir>),23]).mountdir>)>
465506)" );
466507
467- fmt::print (" {}\n " , str);
508+ fmt::print (" {}" , str);
509+ fmt::print (" \n " );
468510 std::exit (EXIT_SUCCESS);
469511}
470512
0 commit comments