Skip to content

Commit 35bebfc

Browse files
committed
args: add sep-title and sep-reset
1 parent fd9fa70 commit 35bebfc

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

assets/config-examples/config_cool.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# This is really system depedent
3232
layout = [
3333
"${red}$<user.name>${0}@${cyan}$<os.hostname>",
34-
"───────────────────────────",
34+
"$<user.sep_reset>",
3535
"${red}$<os.name> ${cyan} $<system.arch>${cyan} \\<- Arch ",
3636
"${red} ^ ${green} $<os.kernel> \\<━━━┓",
3737
"${red} | ${green}┃",

assets/config-examples/config_modified.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
layout = [
3131
"${red}$<user.name>${0}@${cyan}$<os.hostname>",
32-
"───────────────────────────",
32+
"$<user.sep_reset>",
3333
"${red}OS -> $<os.name> $<system.arch>",
3434
"${yellow}Host -> $<system.host>",
3535
"${!#33ffa1}Init -> $<os.initsys_name>",

cufetch.1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,18 @@ Print the version along with the git branch it was built
5757
\fB\-\-bg\-image\fR <path>
5858
Path to image to be used in the background in GUI (put "disable" for disabling in the config)
5959
.TP
60-
\fB\-\-logo\-padding\-top\fR
60+
\fB\-\-logo\-padding\-top\fR <num>
6161
Padding of the logo from the top
6262
.TP
63-
\fB\-\-logo\-padding\-left\fR
63+
\fB\-\-logo\-padding\-left\fR <num>
6464
Padding of the logo from the left
6565
.TP
66+
\fB\-\-sep\-title\fR <string>
67+
A char (or string) to use in $<user.title_sep>
68+
.TP
69+
\fB\-\-sep\-reset\fR <string>
70+
A separetor (or string) that when ecountered, will automatically reset color
71+
.TP
6672
\fB\-\-gen\-config\fR [<path>]
6773
Generate default config file to config folder (if path, it will generate to the path)
6874
.br

src/display.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ std::vector<std::string> Display::render(const Config& config, const colors_t& c
163163
origin += asciiArt.at(i).length();
164164
}
165165

166-
size_t spaces = (maxLineLength + (config.m_disable_source ? 1 : config.offset)) -
167-
(i < asciiArt.size() ? pureAsciiArtLens.at(i) : 0);
166+
const size_t& spaces = (maxLineLength + (config.m_disable_source ? 1 : config.offset)) -
167+
(i < asciiArt.size() ? pureAsciiArtLens.at(i) : 0);
168168

169169
debug("spaces: {}", spaces);
170170

src/main.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ A command-line system information tool (or neofetch like program), which its foc
6464
--logo-padding-top <num> Padding of the logo from the top
6565
--logo-padding-left <num> Padding of the logo from the left
6666
--layout-padding-top <num> Padding of the layout from the top
67+
--sep-title <string> A char (or string) to use in $<user.title_sep>
68+
--sep-reset <string> A separetor (or string) that when ecountered, will automatically reset color
6769
--gen-config [<path>] Generate default config file to config folder (if path, it will generate to the path)
6870
Will ask for confirmation if file exists already
6971
@@ -260,12 +262,15 @@ static bool parseargs(int argc, char* argv[], Config& config, const std::string_
260262
{"distro", required_argument, 0, 'd'},
261263
{"source-path", required_argument, 0, 's'},
262264

265+
{"sep-reset", required_argument, 0, "sep-reset"_fnv1a16},
266+
{"sep-title", required_argument, 0, "sep-title"_fnv1a16},
263267
{"logo-padding-top", required_argument, 0, "logo-padding-top"_fnv1a16},
264268
{"logo-padding-left", required_argument, 0, "logo-padding-left"_fnv1a16},
265269
{"layout-padding-top", required_argument, 0, "layout-padding-top"_fnv1a16},
266270
{"bg-image", required_argument, 0, "bg-image"_fnv1a16},
267271
{"color", required_argument, 0, "color"_fnv1a16},
268272
{"gen-config", optional_argument, 0, "gen-config"_fnv1a16},
273+
269274
{0,0,0,0}
270275
};
271276

@@ -326,7 +331,7 @@ static bool parseargs(int argc, char* argv[], Config& config, const std::string_
326331
case "color"_fnv1a16:
327332
{
328333
const std::string& optarg_str = optarg;
329-
const size_t pos = optarg_str.find('=');
334+
const size_t& pos = optarg_str.find('=');
330335
if (pos == std::string::npos)
331336
die("argument color '{}' does NOT have an equal sign '=' for separiting color name and value.\n"
332337
"for more check with --help", optarg_str);
@@ -345,6 +350,12 @@ static bool parseargs(int argc, char* argv[], Config& config, const std::string_
345350
config.generateConfig(configFile);
346351
exit(EXIT_SUCCESS);
347352

353+
case "sep-reset"_fnv1a16:
354+
config.sep_reset = optarg; break;
355+
356+
case "sep-title"_fnv1a16:
357+
config.user_sep_title = optarg; break;
358+
348359
default:
349360
return false;
350361
}

0 commit comments

Comments
 (0)