From f6040b7afbec15bd1b8fe4b2a01276eaa009024e Mon Sep 17 00:00:00 2001 From: Toni500git Date: Thu, 5 Sep 2024 13:56:38 +0200 Subject: [PATCH] misc: update README.md and some definitions --- README.md | 10 +++++----- include/config.hpp | 8 ++++---- src/parse.cpp | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cc3c6d5..0c07200 100644 --- a/README.md +++ b/README.md @@ -135,8 +135,8 @@ layout = [ "${auto}GPU: $", "${auto}RAM: $", "", - "${\e[40m} ${\e[41m} ${\e[42m} ${\e[43m} ${\e[44m} ${\e[45m} ${\e[46m} ${\e[47m} ", # normal colors - "${\e[100m} ${\e[101m} ${\e[102m} ${\e[103m} ${\e[104m} ${\e[105m} ${\e[106m} ${\e[107m} " # light colors + "$", # normal colors palette + "$" # light colors palette ] # display ascii-art or image/gif (GUI only) near layout @@ -251,12 +251,12 @@ 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.\ +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: `$`, `${color}`, `$(bash command)`, `$[something,equalToSomethingElse,iftrue,ifalse]`. 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 module\ +* **The info tag (`$<>`)** will print a value of a member of a module\ e.g `$` will print the username, `$` will print the kernel version and so on.\ - run "cufetch -l" for a list of builti-in modules + run `cufetch -l` for a list of builti-in modules * **The bash command tag (`$()`)** let's you execute bash commands\ e.g `$(echo \"hello world\")` will indeed echo out Hello world.\ diff --git a/include/config.hpp b/include/config.hpp index 88c679b..ad548e4 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -96,22 +96,22 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config] # as like as the user want, no limitation. # inside here there are 4 "tags": $<> $() ${} $[] -# $<> 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 $ will print the username, $ will print the kernel version and so on. # run "cufetch -l" for a list of builti-in modules -# $() 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 -# $[] is used for equal conditional check +# The Conditional tag $[] is used for equal conditional check # syntax MUST be $[something,equalToSomethingElse,iftrue,ifalse] with no spaces between commas ',' # Each part can have a tag or anything else. # e.g $[$,$(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 -# ${} is used for which color to use for colorizing the text +# The Color tag ${} is used for which color to use for colorizing the text # 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} # diff --git a/src/parse.cpp b/src/parse.cpp index 45fac82..84be837 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -246,28 +246,28 @@ std::string parse(const std::string_view input, systemInfo_t& systemInfo, std::s case ']': { - const size_t& condition_comma = command.find(','); - if (condition_comma == command.npos) - die("condition tag {} doesn't have a comma for separiting the condition", command); + const size_t& conditional_comma = command.find(','); + if (conditional_comma == command.npos) + die("conditional tag {} doesn't have a comma for separiting the conditional", command); - const size_t& equalto_comma = command.find(',', condition_comma + 1); + const size_t& equalto_comma = command.find(',', conditional_comma + 1); if (equalto_comma == command.npos) - die("condition tag {} doesn't have a comma for separiting the equalto", command); + die("conditional tag {} doesn't have a comma for separiting the equalto", command); const size_t& true_comma = command.find(',', equalto_comma + 1); if (true_comma == command.npos) - die("condition tag {} doesn't have a comma for separiting the true statment", command); + die("conditional tag {} doesn't have a comma for separiting the true statment", command); - const std::string& condition = command.substr(0, condition_comma); - const std::string& equalto = command.substr(condition_comma + 1, equalto_comma - condition_comma - 1); + const std::string& conditional = command.substr(0, conditional_comma); + const std::string& equalto = command.substr(conditional_comma + 1, equalto_comma - conditional_comma - 1); const std::string& true_statment = command.substr(equalto_comma + 1, true_comma - equalto_comma - 1); const std::string& false_statment = command.substr(true_comma + 1); std::string _; - const std::string& parsed_condition = parse(condition, systemInfo, _, config, colors, true); + const std::string& parsed_conditional = parse(conditional, systemInfo, _, config, colors, true); const std::string& parsed_equalto = parse(equalto, systemInfo, _, config, colors, true); - if (parsed_condition == parsed_equalto) + if (parsed_conditional == parsed_equalto) { const std::string& parsed_true_stam = parse(true_statment, systemInfo, _, config, colors, true); output = output.replace(dollarSignIndex, (endBracketIndex + 1) - dollarSignIndex,