mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 06:00:08 +01:00
format string more like template language
This commit is contained in:
+15
-1
@@ -154,11 +154,25 @@ static inline void printCommandHelpFormat()
|
||||
"\n"
|
||||
"To make formatting easier, a double open curly brace (\"{{\") will be printed as a single open curly brace and not counted as the beginn of a placeholder.\n"
|
||||
"If a value index is missformatted or wants a non existing value, it will be printed as is, with the curly braces around it.\n"
|
||||
"If the last placeholder isn't closed, it will be printed as is, with the open curly braces at the start.\n"
|
||||
"If the last placeholder isn't closed, it will be treated like it was at the end of the format string.\n"
|
||||
"\n"
|
||||
"To only print something if a variable is set use \"{?<index>} ... {?}\".\n"
|
||||
"For example to only print a second value if it is set use \"{?2} Second value: {2}{?}\".\n"
|
||||
"If a \"{?}\" is found without an opener, it is printed as is.\n"
|
||||
"\n"
|
||||
"To only print something if a variable is not set, do the same as with if, just replace every '?' with a '!'.\n"
|
||||
"For example to print a fallback for a second value if it is not set use \"{?2}{2}{?}{/2}Second value fallback{/}\".\n"
|
||||
"\n"
|
||||
"There is a special variable set if an error occured during detection, you can access it with \"{e}\", \"{error}\" or \"{0}\".\n"
|
||||
"You can use ifs and not ifs with it like with an index, for example use \"{?e}some text{?}\" to print an text if an error occurred.\n"
|
||||
"\n"
|
||||
"To stop formating at any point in the format string, use \"{-}\".\n"
|
||||
"For example to print an error instead of the normal output if it occured, prefix the format string with \"{?e}{e}{-}{?}...\".\n"
|
||||
"\n"
|
||||
"If an format string evaluates to an empty value, the whole line in the output will be discarded.\n"
|
||||
"You can therefore use --host-format \" \" to disable host output.\n"
|
||||
"Note that --host-format \"\" would evaluate as not set, and therefore use the built in host format\n"
|
||||
"This can be used to print nothing if an error occured: prefix the format string with \"{?e}{-}{?}...\".\n"
|
||||
"\n"
|
||||
"Format string is also the way to go to set a fixed value, just use one without placeholders.\n"
|
||||
"For example when running in headless mode you could use \"--resolution-format \"Preferred\"."
|
||||
|
||||
Reference in New Issue
Block a user