Skip to content

Commit 3f3a1a9

Browse files
committed
src/cli/rustup_mode.rs: Add verbose_arg() helper
1 parent 0b435ea commit 3f3a1a9

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/cli/rustup_mode.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,7 @@ pub(crate) fn cli() -> App<'static, 'static> {
214214
.setting(AppSettings::DeriveDisplayOrder)
215215
.setting(AppSettings::SubcommandRequiredElseHelp)
216216
.arg(
217-
Arg::with_name("verbose")
218-
.help("Enable verbose output")
219-
.short("v")
220-
.long("verbose"),
217+
verbose_arg("Enable verbose output"),
221218
)
222219
.arg(
223220
Arg::with_name("quiet")
@@ -253,11 +250,7 @@ pub(crate) fn cli() -> App<'static, 'static> {
253250
.about("Show the active toolchain")
254251
.after_help(SHOW_ACTIVE_TOOLCHAIN_HELP)
255252
.arg(
256-
Arg::with_name("verbose")
257-
.help("Enable verbose output with rustc information")
258-
.takes_value(false)
259-
.short("v")
260-
.long("verbose"),
253+
verbose_arg("Enable verbose output with rustc information"),
261254
),
262255
)
263256
.subcommand(
@@ -360,11 +353,7 @@ pub(crate) fn cli() -> App<'static, 'static> {
360353
SubCommand::with_name("list")
361354
.about("List installed toolchains")
362355
.arg(
363-
Arg::with_name("verbose")
364-
.help("Enable verbose output with toolchain information")
365-
.takes_value(false)
366-
.short("v")
367-
.long("verbose"),
356+
verbose_arg("Enable verbose output with toolchain information"),
368357
),
369358
)
370359
.subcommand(
@@ -746,6 +735,14 @@ pub(crate) fn cli() -> App<'static, 'static> {
746735
)
747736
}
748737

738+
fn verbose_arg<'a, 'b>(help: &'b str) -> Arg<'a, 'b> {
739+
Arg::with_name("verbose")
740+
.help(help)
741+
.takes_value(false)
742+
.short("v")
743+
.long("verbose")
744+
}
745+
749746
fn maybe_upgrade_data(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<bool> {
750747
match m.subcommand() {
751748
("self", Some(c)) => match c.subcommand() {

0 commit comments

Comments
 (0)