Skip to content

Commit 0d0f1b3

Browse files
authored
Merge pull request #10 from tranzystorek-io/clap-v3
Update arg parsing to clap v3
2 parents 3c6288e + 3fc34be commit 0d0f1b3

File tree

5 files changed

+194
-169
lines changed

5 files changed

+194
-169
lines changed

Cargo.lock

Lines changed: 128 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ categories = ["command-line-utilities", "development-tools"]
1212
build = "build.rs"
1313

1414
[build-dependencies]
15-
clap = "~2.33.0"
15+
clap = { version = "3.0", features = ["derive"] }
16+
clap_complete = "3.0"
1617

1718
[dependencies]
1819
atty = "~0.2.11"
19-
clap = "~2.33.0"
20+
clap = { version = "3.0", features = ["derive"] }
2021
num_cpus = "1"
2122
rayon = "~1.4.0"
2223
regex = "1"

build.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use clap::Shell;
1+
use clap::{ArgEnum, IntoApp};
2+
use clap_complete::Shell;
23

34
use std::{env, fs, path};
45

@@ -20,15 +21,8 @@ fn main() {
2021
}
2122

2223
// use clap to build completion files
23-
let mut app = cli::build_cli();
24-
let variants = &[
25-
Shell::Bash,
26-
Shell::Fish,
27-
Shell::Zsh,
28-
Shell::PowerShell,
29-
Shell::Elvish,
30-
];
31-
for &variant in variants {
32-
app.gen_completions("gitall", variant, outdir.clone());
24+
let mut cli = cli::Cli::into_app();
25+
for &variant in Shell::value_variants() {
26+
clap_complete::generate_to(variant, &mut cli, "gitall", outdir.clone()).unwrap();
3327
}
3428
}

0 commit comments

Comments
 (0)