Skip to content

Commit 171c099

Browse files
committed
reorder -z flag
1 parent 5b10724 commit 171c099

File tree

2 files changed

+135
-144
lines changed

2 files changed

+135
-144
lines changed

Diff for: Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ yaml-rust = "0.4"
3838
serde = "1.0.119"
3939
serde_json = "1.0.61"
4040
serde_yaml = "0.8"
41-
4241
chrono = "0.4"
4342
chrono-humanize = "0.1.1"
4443
byte-unit = "4.0.9"

Diff for: src/onefetch/cli.rs

+135-143
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub struct Cli {
4040
}
4141

4242
impl Cli {
43-
/// Build `Options` from command line arguments.
4443
pub fn new() -> Result<Self> {
4544
#[cfg(not(windows))]
4645
let possible_backends = ["kitty", "iterm", "sixel"];
@@ -59,8 +58,8 @@ impl Cli {
5958
Arg::with_name("input")
6059
.default_value(".")
6160
.hide_default_value(true)
62-
.help("Run as if onefetch was started in <input> instead of the current working directory.",
63-
))
61+
.help("Run as if onefetch was started in <input> instead of the current working directory.")
62+
)
6463
.arg(
6564
Arg::with_name("output")
6665
.short("o")
@@ -70,13 +69,7 @@ impl Cli {
7069
.possible_values(&SerializationFormat::iter()
7170
.map(|format| format.into())
7271
.collect::<Vec<&str>>())
73-
)
74-
.arg(
75-
Arg::with_name("isotime")
76-
.short("z")
77-
.long("isotime")
78-
.help("Outputs Onefetch with ISO 8601 formatted timestamps")
79-
)
72+
)
8073
.arg(
8174
Arg::with_name("languages")
8275
.short("l")
@@ -87,181 +80,180 @@ impl Cli {
8780
Arg::with_name("package-managers")
8881
.short("p")
8982
.long("package-managers")
90-
.help("Prints out supported package managers."),
91-
)
92-
.arg(
93-
Arg::with_name("show-logo")
94-
.long("show-logo")
95-
.value_name("WHEN")
96-
.takes_value(true)
97-
.possible_values(&["auto", "never", "always"])
98-
.default_value("always")
99-
.hide_default_value(true)
100-
.help("Specify when to show the logo (auto, never, *always*).")
101-
.long_help(
102-
"Specify when to show the logo (auto, never, *always*). \n\
103-
If set to auto: the logo will be hidden if the terminal's width < 95."
104-
)
83+
.help("Prints out supported package managers."),
84+
)
85+
.arg(
86+
Arg::with_name("show-logo")
87+
.long("show-logo")
88+
.value_name("WHEN")
89+
.takes_value(true)
90+
.possible_values(&["auto", "never", "always"])
91+
.default_value("always")
92+
.hide_default_value(true)
93+
.help("Specify when to show the logo (auto, never, *always*).")
94+
.long_help(
95+
"Specify when to show the logo (auto, never, *always*). \n\
96+
If set to auto: the logo will be hidden if the terminal's width < 95.")
10597
)
10698
.arg(
10799
Arg::with_name("image")
108-
.short("i")
109-
.long("image")
110-
.value_name("IMAGE")
111-
.takes_value(true)
112-
.help("Path to the IMAGE file."),
100+
.short("i")
101+
.long("image")
102+
.value_name("IMAGE")
103+
.takes_value(true)
104+
.help("Path to the IMAGE file."),
113105
)
114106
.arg(
115107
Arg::with_name("image-backend")
116-
.long("image-backend")
117-
.value_name("BACKEND")
118-
.takes_value(true)
119-
.requires("image")
120-
.possible_values(&possible_backends)
121-
.help("Which image BACKEND to use."),
108+
.long("image-backend")
109+
.value_name("BACKEND")
110+
.takes_value(true)
111+
.requires("image")
112+
.possible_values(&possible_backends)
113+
.help("Which image BACKEND to use."),
122114
)
123115
.arg(
124116
Arg::with_name("color-resolution")
125-
.long("color-resolution")
126-
.value_name("VALUE")
127-
.requires("image")
128-
.takes_value(true)
129-
.possible_values(&["16", "32", "64", "128", "256"])
130-
.help("VALUE of color resolution to use with SIXEL backend."),
117+
.long("color-resolution")
118+
.value_name("VALUE")
119+
.requires("image")
120+
.takes_value(true)
121+
.possible_values(&["16", "32", "64", "128", "256"])
122+
.help("VALUE of color resolution to use with SIXEL backend."),
131123
)
132124
.arg(
133125
Arg::with_name("ascii-language")
134-
.short("a")
135-
.value_name("LANGUAGE")
136-
.long("ascii-language")
137-
.takes_value(true)
138-
.case_insensitive(true)
139-
.help("Which LANGUAGE's ascii art to print.")
140-
.possible_values(
141-
&Language::iter()
142-
.map(|language| language.into())
143-
.collect::<Vec<&str>>()
144-
),
126+
.short("a")
127+
.value_name("LANGUAGE")
128+
.long("ascii-language")
129+
.takes_value(true)
130+
.case_insensitive(true)
131+
.help("Which LANGUAGE's ascii art to print.")
132+
.possible_values(
133+
&Language::iter()
134+
.map(|language| language.into())
135+
.collect::<Vec<&str>>())
145136
)
146137
.arg(
147138
Arg::with_name("ascii-input")
148-
.long("ascii-input")
149-
.value_name("STRING")
150-
.takes_value(true)
151-
.help("Takes a non-empty STRING as input to replace the ASCII logo.")
152-
.long_help(
153-
"Takes a non-empty STRING as input to replace the ASCII logo. \
154-
It is possible to pass a generated STRING by command substitution. \n\
155-
For example:\n \
156-
'--ascii-input \"$(fortune | cowsay -W 25)\"'"
157-
)
158-
.validator(
159-
|t| {
160-
if t.is_empty() {
161-
return Err(String::from("must not be empty"));
162-
}
163-
Ok(())
164-
},
165-
),
139+
.long("ascii-input")
140+
.value_name("STRING")
141+
.takes_value(true)
142+
.help("Takes a non-empty STRING as input to replace the ASCII logo.")
143+
.long_help(
144+
"Takes a non-empty STRING as input to replace the ASCII logo. \
145+
It is possible to pass a generated STRING by command substitution. \n\
146+
For example:\n \
147+
'--ascii-input \"$(fortune | cowsay -W 25)\"'")
148+
.validator(
149+
|t| {
150+
if t.is_empty() {
151+
return Err(String::from("must not be empty"));
152+
}
153+
Ok(())
154+
},
155+
),
166156
)
167157
.arg(
168158
Arg::with_name("ascii-colors")
169-
.short("c")
170-
.long("ascii-colors")
171-
.value_name("X")
172-
.multiple(true)
173-
.takes_value(true)
174-
.possible_values(color_values)
175-
.help("Colors (X X X...) to print the ascii art."),
159+
.short("c")
160+
.long("ascii-colors")
161+
.value_name("X")
162+
.multiple(true)
163+
.takes_value(true)
164+
.possible_values(color_values)
165+
.help("Colors (X X X...) to print the ascii art."),
176166
)
177167
.arg(
178168
Arg::with_name("true-color")
179-
.long("true-color")
180-
.value_name("WHEN")
181-
.takes_value(true)
182-
.possible_values(&["auto", "never", "always"])
183-
.default_value("auto")
184-
.hide_default_value(true)
185-
.help("Specify when to use true color (*auto*, never, always).")
186-
.long_help(
187-
"Specify when to use true color (*auto*, never, always). \n\
188-
If set to auto: true color will be enabled if supported by the terminal."
189-
)
169+
.long("true-color")
170+
.value_name("WHEN")
171+
.takes_value(true)
172+
.possible_values(&["auto", "never", "always"])
173+
.default_value("auto")
174+
.hide_default_value(true)
175+
.help("Specify when to use true color (*auto*, never, always).")
176+
.long_help(
177+
"Specify when to use true color (*auto*, never, always). \n\
178+
If set to auto: true color will be enabled if supported by the terminal.")
190179
)
191180
.arg(
192181
Arg::with_name("text-colors")
193-
.short("t")
194-
.long("text-colors")
195-
.value_name("X")
196-
.multiple(true)
197-
.takes_value(true)
198-
.max_values(6)
199-
.possible_values(color_values)
200-
.help("Changes the text colors (X X X...).")
201-
.long_help(
202-
"Changes the text colors (X X X...). \
203-
Goes in order of title, ~, underline, subtitle, colon, and info. \n\
204-
For example:\n \
205-
'--text-colors 9 10 11 12 13 14'"
206-
)
182+
.short("t")
183+
.long("text-colors")
184+
.value_name("X")
185+
.multiple(true)
186+
.takes_value(true)
187+
.max_values(6)
188+
.possible_values(color_values)
189+
.help("Changes the text colors (X X X...).")
190+
.long_help(
191+
"Changes the text colors (X X X...). \
192+
Goes in order of title, ~, underline, subtitle, colon, and info. \n\
193+
For example:\n \
194+
'--text-colors 9 10 11 12 13 14'")
207195
)
208196
.arg(
209197
Arg::with_name("no-bold")
210-
.long("no-bold")
211-
.help("Turns off bold formatting."),
198+
.long("no-bold")
199+
.help("Turns off bold formatting."),
212200
)
213201
.arg(
214202
Arg::with_name("no-color-palette")
215-
.long("no-color-palette")
216-
.help("Hides the color palette."),
203+
.long("no-color-palette")
204+
.help("Hides the color palette."),
217205
)
218206
.arg(
219207
Arg::with_name("no-merge-commits")
220-
.long("no-merge-commits")
221-
.help("Ignores merge commits."),
208+
.long("no-merge-commits")
209+
.help("Ignores merge commits."),
210+
)
211+
.arg(
212+
Arg::with_name("isotime")
213+
.short("z")
214+
.long("isotime")
215+
.help("Use ISO 8601 formatted timestamps.")
222216
)
223217
.arg(
224218
Arg::with_name("disable-fields")
225-
.long("disable-fields")
226-
.short("d")
227-
.value_name("FIELD")
228-
.multiple(true)
229-
.takes_value(true)
230-
.case_insensitive(true)
231-
.help("Allows you to disable FIELD(s) from appearing in the output.")
232-
.possible_values(
233-
&InfoField::iter()
234-
.map(|field| field.into())
235-
.collect::<Vec<&str>>()
236-
),
219+
.long("disable-fields")
220+
.short("d")
221+
.value_name("FIELD")
222+
.multiple(true)
223+
.takes_value(true)
224+
.case_insensitive(true)
225+
.help("Allows you to disable FIELD(s) from appearing in the output.")
226+
.possible_values(
227+
&InfoField::iter()
228+
.map(|field| field.into())
229+
.collect::<Vec<&str>>())
237230
)
238231
.arg(
239232
Arg::with_name("authors-number")
240-
.short("A")
241-
.long("authors-number")
242-
.value_name("NUM")
243-
.takes_value(true)
244-
.default_value("3")
245-
.help("NUM of authors to be shown.")
246-
.validator(
247-
|t| {
248-
t.parse::<u32>()
249-
.map_err(|_t| "must be a number")
250-
.map(|_t|())
251-
.map_err(|e| e.to_string())
252-
},
253-
)
233+
.short("A")
234+
.long("authors-number")
235+
.value_name("NUM")
236+
.takes_value(true)
237+
.default_value("3")
238+
.help("NUM of authors to be shown.")
239+
.validator(
240+
|t| {
241+
t.parse::<u32>()
242+
.map_err(|_t| "must be a number")
243+
.map(|_t|())
244+
.map_err(|e| e.to_string())
245+
})
254246
)
255247
.arg(
256248
Arg::with_name("exclude")
257-
.short("e")
258-
.long("exclude")
259-
.value_name("EXCLUDE")
260-
.multiple(true)
261-
.takes_value(true)
262-
.help("Ignore all files & directories matching EXCLUDE."),
263-
)
264-
.get_matches();
249+
.short("e")
250+
.long("exclude")
251+
.value_name("EXCLUDE")
252+
.multiple(true)
253+
.takes_value(true)
254+
.help("Ignore all files & directories matching EXCLUDE."),
255+
)
256+
.get_matches();
265257

266258
let true_color = match matches.value_of("true-color") {
267259
Some("always") => true,

0 commit comments

Comments
 (0)