Skip to content

Commit

Permalink
doc: improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni500github committed Sep 5, 2024
1 parent f6040b7 commit 43e9335
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 40 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,26 @@ bg-image = "/tmp/idk.png"

```

We got the `config.toml` file, in there we got an array variable called "layout". That's the variable where you customize how the infos should be displayed.\
You have 4 tags: `$<module.member>`, `${color}`, `$(bash command)`, `$[something,equalToSomethingElse,iftrue,ifalse]`. They can be used in the ascii art text file and layout, but how to use them?
We use the `config.toml` file, in there we got an array variable called "layout". That's the variable where you customize how the infos should be displayed.\
You have 4 tags:
* `$<module.member>` - Used for printing the value of a member of a module.
* `${color}` - Used for displaying text in a specific color.
* `$(bash command)` - Used to execute bash commands and print the output.
* `$[something,equalToSomethingElse,iftrue,ifalse]` - Conditional tag to display different outputs based on the comparison.

They can be used in the ascii art text file and layout, but how to use them?

* **The info tag (`$<>`)** will print a value of a member of a module\
e.g `$<user.name>` will print the username, `$<os.kernel_version>` will print the kernel version and so on.\
run `cufetch -l` for a list of builti-in modules
All the modules and their members are listed in the `--list-modules` argument

* **The bash command tag (`$()`)** let's you execute bash commands\
* **The bash command tag (`$()`)** let's you execute bash commands and print the output\
e.g `$(echo \"hello world\")` will indeed echo out Hello world.\
you can even use pipes\
e.g `$(echo \"hello world\" | cut -d' ' -f2)` will only print world

* **The conditional tag (`$[]`)** is used for equal conditional check.\
Syntax MUST be `$[something,equalToSomethingElse,iftrue,ifalse]` with no spaces between commas ','\
* **The conditional tag (`$[]`)** is used for displaying different outputs based on the comparison.\
Syntax MUST be `$[something,equalToSomethingElse,iftrue,ifalse]` with no spaces between commas.\
Each part can have a tag or anything else.\
e.g `$[$<user.name>,$(echo $USER),the name is correct,the name is NOT correct]`\
This is useful when on some terminal or WM the detection can be different than others\
Expand All @@ -283,8 +289,9 @@ You have 4 tags: `$<module.member>`, `${color}`, `$(bash command)`, `$[something
For auto coloring, depending on the ascii logo colors, use `${auto}`.\
They can be used for different colors too. So for getting the 2nd color of the ascii logo,\
use `${auto2}`, for the 4th one use `${auto4}` and so on.
If you're in GUI mode and the source path is an image, all the auto colors will be white

Any `$` or brackets can be escaped with \\
Any `$` or brackets can be escaped with a backslash `\`

# Thanks
I would like to thanks:
Expand Down
56 changes: 34 additions & 22 deletions cufetch.1
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,20 @@ customfetch focus point is to be customizable and fast at the same time.
.PP
How does it work?
.PP
We got the config.toml file, in there we got an array variable called "layout". That's the variable where you customize how the infos should be displayed.
We use the \fBconfig.toml\fR file, in there we got an array variable called "layout". That's the variable where you customize how the infos should be displayed.
.PP
You have 4 tags:
.br
* \fB$<module.member>\fR - Used for printing the value of a member of a module.
.br
* \fB${color}\fR - Used for displaying text in a specific color.
.br
You have 4 tags: $<module.member>, ${color}, $(bash command), $[something,equalToSomething,ifTrue,ifFalse]. They can be used in the ascii art text file and layout, but how to use them?
* \fB$(bash command)\fR - Used to execute bash commands and print the output.
.br
* \fB$[something,equalToSomething,ifTrue,ifFalse]\fR - Conditional tag to display different outputs based on the comparison.
.PP
They can be used in the ascii art text file and layout, but how to use them?
.br
Here's a simple bare-minimal example:
.br
layout = [
Expand All @@ -26,39 +36,41 @@ layout = [
.br
]
.PP
The \fBInfo tag $<>\fR let's you print a part of a module. All the modules and their parts are listed in the `--list-modules` argument
The \fBInfo tag $<>\fR will prints a member of a module. All the modules and their members are listed in the `--list-modules` argument
.PP
The \fBColor tag ${}\fR is used for printing the text of a certain color.
.br
The colors can be: \fIblack\fR, \fIred\fR, \fIgreen\fR, \fIblue\fR, \fIcyan\fR, \fIyellow\fR, \fImagenta\fR, \fIwhite\fR and they can be configured in the config file.
The colors can be predefined such as: \fIblack\fR, \fIred\fR, \fIgreen\fR, \fIblue\fR, \fIcyan\fR, \fIyellow\fR, \fImagenta\fR, \fIwhite\fR and they can be configured in the config file.
.br
They can have hexcodes colors, e.g "#5522dd".
They can have hexcodes colors (e.g "#5522dd").
.br
It's possible to enable multiple options, put these symbols before '#':
You can apply special effects to colors by using the following symbols before the '#' in hex codes:
.br
* \fBb\fR for making the color in the background
* \fBb\fR for background color.
.br
* \fBu\fR for underline the text
* \fBu\fR for underlining the text.
.br
* \fB!\fR for making the text bold
* \fB!\fR for bold text.
.br
* \fBi\fR for making the text italic

OR They can have ANSI escape codes, e.g "\\e[1;31m" and "\\e[38;5;160m" (\fBNOTE\fR: 256 colors ANSI escape codes, those that have \\e[38 or \\e[48, can't be used in GUI)
* \fBi\fR for italic text.
.PP
Alternatively, ANSI escape codes can be used, e.g "\\e[1;31m" and "\\e[38;5;160m", but \fBnote\fR that 256-color ANSI escape codes (those that starts with \\[38 or \\[48) cannot be used in GUI mode.
.br
You can also use them inside the tag, like \fB${!#343345}\fR or \fB${\\e[1;31m}\fR.
.br
You can also use them inside the tag, like ${!#343345} or ${\\e[1;31m}.
To reset colors, use \fB${0}\fR for a full reset or \fB${1}\fR for a bold reset.
.br
To reset colors use ${0} or ${1} for reset and bold text.
To use the colors that the ascii art logo uses, use \fB${auto}\fR for getting the 1st color, \fB${auto4}\fR for the 4th one and so on.
.br
To instead use the colors that the ascii art logo uses, use ${auto} for getting the 1st color, ${auto4} for the 4th one and so on.
If you're using GUI mode, all the \fB${auto}\fR colors are going to be ${white}
.PP
The \fBConditional tag $[]\fR is used for equal conditional check.
The \fBConditional tag $[]\fR is used to display different outputs based on the comparison.
.br
syntax \fBMUST\fR be $[something,equalToSomethingElse,ifTrue,ifFalse] with no spaces between commas ','
The syntax \fBMUST\fR be: $[something,equalToSomethingElse,ifTrue,ifFalse] with no spaces between commas
.br
Each part can have a tag or anything else.
.br
e.g $[$<user.name>,$(echo $USER),the name is correct,the name is NOT correct]
.PP
For example: $[$<user.name>,$(echo $USER),correct,NOT correct]
.br
This is useful when on some terminal or WM the detection can be different than others
.PP
Expand Down Expand Up @@ -127,7 +139,7 @@ Padding of the logo from the left
A char (or string) to use in $<builtin.title_sep>
.TP
\fB\-\-sep\-reset\fR <string>
A separator (or string) that when ecountered, will automatically reset color
A separator (or string) that when encountered, will automatically reset color
.TP
\fB\-\-sep\-reset\-after\fR [<num>]
Reset color either before of after 'sep-reset' (1 = after && 0 = before)
Expand All @@ -140,9 +152,9 @@ Will ask for confirmation if file exists already
\fB\-\-color\fR <string>
Replace instances of a color with another value.
.br
Syntax MUST be "name=value" with no space beetween "=", example: --color "foo=#444333".
Syntax MUST be "name=value" with no space between "=", example: --color "foo=#444333".
.br
Thus replaces any instance of foo with #444333. Can be done with multiple colors separetly.
Thus replaces any instance of foo with #444333. Can be done with multiple colors separately.
.br
Matter of fact, you can: --color "#hexcode=#anotherhexcode"
.SH BUGS
Expand Down
23 changes: 12 additions & 11 deletions include/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,41 +96,42 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config]
# as like as the user want, no limitation.
# inside here there are 4 "tags": $<> $() ${} $[]
# The Info tag $<> lets you print the value of a member of a module
# The Info tag $<> lets you print the value of a member of a module.
# e.g $<user.name> will print the username, $<os.kernel_version> will print the kernel version and so on.
# run "cufetch -l" for a list of builti-in modules
# All the modules and their members are listed in the `--list-modules` argument
# The Bash command tag $() let's you execute bash commands
# The Bash command tag $() let's you execute bash commands.
# e.g $(echo \"hello world\") will indeed echo out Hello world.
# you can even use pipes
# e.g $(echo \"hello world\" | cut -d' ' -f2) will only print world
# The Conditional tag $[] is used for equal conditional check
# The Conditional tag $[] is used to display different outputs based on the comparison.
# syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse] with no spaces between commas ','
# Each part can have a tag or anything else.
# e.g $[$<user.name>,$(echo $USER),the name is correct,the name is NOT correct]
# This is useful when on some terminal or WM the detection can be different than others
# The Color tag ${} is used for which color to use for colorizing the text
# The Color tag ${} is used for printing the text of a certain color.
# e.g "${red}hello world" will indeed print "hello world" in red (or the color you set in the variable)
# you can even put a custom hex color e.g: ${#ff6622}
#
# It's possible to enable multiple options, put these symbols before '#':
# * b, for making the color in the background
# * u, for underline the text
# * !, for making the text bold
# * i, for making the text italic
#
# OR bash escape code colors e.g ${\e[1;32m} or ${\e[0;34m}.
# Alternatively, ANSI escape codes can be used, e.g ${\e[1;32m} or ${\e[0;34m}.
# NOTE: 256-color ANSI escape codes (those that starts with \\[38 or \\[48) cannot be used in GUI mode.
#
# To reset colors, use ${0} for a full reset or ${1} for a bold reset.
#
# For auto coloring, depending on the ascii logo colors, use ${auto}.
# They can be used for different colors too. So for getting the 2nd color of the ascii logo,
# use ${auto2}, for the 4th one use ${auto4} and so on.
#
# If you're using GUI mode, all the \fB${auto}\fR colors are going to be ${white}
# Little FAQ
# Q: "but then if I want to make only some words/chars in a color and the rest normal?"
# A: there is ${0}. e.g "${red}hello ${0}world, yet again" will only print "hello" in red, and then "world, yet again" normal
# Or, if you want to reset color and make it bold, use ${1}
# Q: "Why when I use something like "$<os.kernel> <- Kernel" it won't work on GUI mode?"
# A: replace "<-" with "\\<-". It won't affect the printing in terminal
Expand Down

0 comments on commit 43e9335

Please sign in to comment.