Skip to content

Commit e7d6997

Browse files
committed
cli: fix clap deprecation warnings from version 3.2.0 onwards
See clap changelog: https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#320---2022-06-13 (also check out the clap issue 3822)
1 parent 79681c5 commit e7d6997

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/cli/root_command.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use crate::github::Repository;
77

88
#[derive(Debug, Parser)]
99
#[clap(
10-
name = "dra",
11-
version,
12-
about = "A command line tool to download release assets from GitHub",
13-
long_about = "A command line tool to download release assets from GitHub.
10+
name = "dra",
11+
version,
12+
about = "A command line tool to download release assets from GitHub",
13+
long_about = "A command line tool to download release assets from GitHub.
1414
1515
EXAMPLES:
1616
Select and download an asset:
@@ -37,47 +37,47 @@ pub enum Command {
3737
/// Select and download an asset
3838
Download {
3939
/// Github repository using format {owner}/{repo}
40-
#[clap(parse(try_from_str = try_parse_repository))]
40+
#[clap(value_parser = try_parse_repository)]
4141
repo: Repository,
4242

4343
/// Untagged asset name to automatically select which asset to download
4444
///
4545
/// Usually this value is generated by the command `untag`
46-
#[clap(short = 's', long = "select")]
46+
#[clap(short = 's', long = "select", action)]
4747
select: Option<String>,
4848

4949
/// Set the tag name for fetching a specific release
5050
///
5151
/// Latest release is used if not specified
52-
#[clap(short = 't', long = "tag")]
52+
#[clap(short = 't', long = "tag", action)]
5353
tag: Option<String>,
5454

5555
/// Save asset to custom path
5656
///
5757
/// Default path is current working directory and the name of the asset.
5858
///
5959
/// If used with `--install` it must be a directory path
60-
#[clap(short = 'o', long = "output", parse(from_os_str), value_hint = ValueHint::AnyPath)]
60+
#[clap(short = 'o', long = "output", action, value_hint = ValueHint::AnyPath)]
6161
output: Option<PathBuf>,
6262

6363
/// Install downloaded asset
6464
///
6565
/// If the downloaded asset is a supported file, it will try to install it.
6666
/// By default is not used.
67-
#[clap(short = 'i', long = "install")]
67+
#[clap(short = 'i', long = "install", action)]
6868
install: bool,
6969
},
7070

7171
/// Select an asset and generate an untagged version of it
7272
Untag {
7373
/// Github repository using format {owner}/{repo}
74-
#[clap(parse(try_from_str = try_parse_repository))]
74+
#[clap(value_parser = try_parse_repository)]
7575
repo: Repository,
7676
},
7777

7878
/// Generate shell completion
7979
Completion {
80-
#[clap(arg_enum)]
80+
#[clap(value_enum, action)]
8181
shell: clap_complete::Shell,
8282
},
8383
}

src/github/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub mod tagged_asset;
1111

1212
pub const GITHUB_TOKEN: &str = "GITHUB_TOKEN";
1313

14-
#[derive(Debug, Eq, PartialEq)]
14+
#[derive(Debug, Eq, PartialEq, Clone)]
1515
pub struct Repository {
1616
pub owner: String,
1717
pub repo: String,

0 commit comments

Comments
 (0)