Skip to content

Commit 39ea532

Browse files
committed
Update clap dependency
1 parent 9bca3a5 commit 39ea532

File tree

7 files changed

+95
-47
lines changed

7 files changed

+95
-47
lines changed

Cargo.lock

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

surface-dtx-daemon/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ build = "build.rs"
1313
[dependencies]
1414
anyhow = "1.0.57"
1515
atty = "0.2.14"
16-
clap = "2.33.3"
16+
clap = { version = "3.1.12", features = ["cargo"] }
1717
dbus = "0.9.5"
1818
dbus-tokio = "0.7.5"
1919
dbus-crossroads = "0.5.0"
@@ -30,4 +30,5 @@ tracing = "0.1.34"
3030
tracing-subscriber = { version = "0.3.11", features = ["std", "env-filter"] }
3131

3232
[build-dependencies]
33-
clap = "2.33.3"
33+
clap = "3.1.12"
34+
clap_complete = "3.1.2"

surface-dtx-daemon/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::env;
2-
use clap::Shell;
2+
use clap_complete::shells;
33

44
include!("src/cli.rs");
55

@@ -10,7 +10,7 @@ fn main() {
1010
.unwrap();
1111

1212
let mut app = app();
13-
app.gen_completions("surface-dtx-daemon", Shell::Bash, &outdir);
14-
app.gen_completions("surface-dtx-daemon", Shell::Zsh, &outdir);
15-
app.gen_completions("surface-dtx-daemon", Shell::Fish, &outdir);
13+
clap_complete::generate_to(shells::Bash, &mut app, "surface-dtx-daemon", &outdir).unwrap();
14+
clap_complete::generate_to(shells::Zsh, &mut app, "surface-dtx-daemon", &outdir).unwrap();
15+
clap_complete::generate_to(shells::Fish, &mut app, "surface-dtx-daemon", &outdir).unwrap();
1616
}

surface-dtx-daemon/src/cli.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
use clap::{App, Arg};
1+
use clap::{Arg, Command};
22

3-
pub fn app() -> App<'static, 'static> {
4-
App::new("Surface DTX Daemon")
3+
pub fn app() -> Command<'static> {
4+
Command::new("Surface DTX Daemon")
55
.about(clap::crate_description!())
66
.version(clap::crate_version!())
77
.author(clap::crate_authors!())
8-
.arg(Arg::with_name("config")
9-
.short("c")
8+
.arg(Arg::new("config")
9+
.short('c')
1010
.long("config")
1111
.value_name("FILE")
1212
.help("Use the specified config file")
1313
.takes_value(true))
14-
.arg(Arg::with_name("no-log-time")
14+
.arg(Arg::new("no-log-time")
1515
.long("no-log-time")
1616
.help("Do not emit timestamps in log"))
1717
}

surface-dtx-userd/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ build = "build.rs"
1313
[dependencies]
1414
anyhow = "1.0.57"
1515
atty = "0.2.14"
16-
clap = "2.33.3"
16+
clap = { version = "3.1.12", features = ["cargo"] }
1717
dbus = "0.9.5"
1818
dbus-tokio = "0.7.5"
1919
futures = "0.3.21"
@@ -25,4 +25,5 @@ tracing = "0.1.34"
2525
tracing-subscriber = { version = "0.3.11", features = ["std", "env-filter"] }
2626

2727
[build-dependencies]
28-
clap = "2.33.3"
28+
clap = "3.1.12"
29+
clap_complete = "3.1.2"

surface-dtx-userd/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::env;
2-
use clap::Shell;
2+
use clap_complete::shells;
33

44
include!("src/cli.rs");
55

@@ -10,7 +10,7 @@ fn main() {
1010
.unwrap();
1111

1212
let mut app = app();
13-
app.gen_completions("surface-dtx-userd", Shell::Bash, &outdir);
14-
app.gen_completions("surface-dtx-userd", Shell::Zsh, &outdir);
15-
app.gen_completions("surface-dtx-userd", Shell::Fish, &outdir);
13+
clap_complete::generate_to(shells::Bash, &mut app, "surface-dtx-userd", &outdir).unwrap();
14+
clap_complete::generate_to(shells::Zsh, &mut app, "surface-dtx-userd", &outdir).unwrap();
15+
clap_complete::generate_to(shells::Fish, &mut app, "surface-dtx-userd", &outdir).unwrap();
1616
}

surface-dtx-userd/src/cli.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
use clap::{App, Arg};
1+
use clap::{Arg, Command};
22

3-
pub fn app() -> App<'static, 'static> {
4-
App::new("Surface DTX User Daemon")
3+
pub fn app() -> Command<'static> {
4+
Command::new("Surface DTX User Daemon")
55
.about(clap::crate_description!())
66
.version(clap::crate_version!())
77
.author(clap::crate_authors!())
8-
.arg(Arg::with_name("config")
9-
.short("c")
8+
.arg(Arg::new("config")
9+
.short('c')
1010
.long("config")
1111
.value_name("FILE")
1212
.help("Use the specified config file")
1313
.takes_value(true))
14-
.arg(Arg::with_name("no-log-time")
14+
.arg(Arg::new("no-log-time")
1515
.long("no-log-time")
1616
.help("Do not emit timestamps in log"))
1717
}

0 commit comments

Comments
 (0)