Skip to content

Commit 0589827

Browse files
committed
chore: update to clap 3.2.25
1 parent 196e4af commit 0589827

File tree

14 files changed

+130
-155
lines changed

14 files changed

+130
-155
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ serde_json = "1.0.111"
2727
lazy_static = "1.3.0"
2828
log = { version = "0.4", features = ["std"] }
2929
node-semver = "2"
30-
structopt = "0.3.26"
30+
clap = { version = "3.2.23", features = ["derive"] }
31+
clap_complete = "3.2.5"
3132
cfg-if = "1.0"
3233
mockito = { version = "0.31.1", optional = true }
3334
test-support = { path = "crates/test-support" }

src/cli.rs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
use structopt::StructOpt;
1+
use clap::Parser;
22

33
use crate::command::{self, Command};
44
use volta_core::error::{ExitCode, Fallible};
55
use volta_core::session::Session;
66

7-
#[derive(StructOpt)]
8-
#[structopt(
7+
#[derive(Parser)]
8+
#[clap(
99
name = "Volta",
1010
about = "The JavaScript Launcher ⚡",
1111
long_about = "The JavaScript Launcher ⚡
1212
1313
To install a tool in your toolchain, use `volta install`.
1414
To pin your project's runtime or package manager, use `volta pin`.",
15-
global_setting = structopt::clap::AppSettings::ColoredHelp,
16-
global_setting = structopt::clap::AppSettings::ColorAuto,
17-
global_setting = structopt::clap::AppSettings::DeriveDisplayOrder,
18-
global_setting = structopt::clap::AppSettings::DisableVersion,
19-
global_setting = structopt::clap::AppSettings::DontCollapseArgsInUsage,
20-
global_setting = structopt::clap::AppSettings::VersionlessSubcommands
15+
global_setting = clap::AppSettings::ColoredHelp,
16+
global_setting = clap::AppSettings::ColorAuto,
17+
global_setting = clap::AppSettings::DeriveDisplayOrder,
18+
global_setting = clap::AppSettings::DisableVersion,
19+
global_setting = clap::AppSettings::DontCollapseArgsInUsage,
2120
)]
2221
pub(crate) struct Volta {
23-
#[structopt(subcommand)]
22+
#[clap(subcommand)]
2423
pub(crate) command: Option<Subcommand>,
2524

26-
#[structopt(long = "verbose", help = "Enables verbose diagnostics", global = true)]
25+
#[clap(long = "verbose", help = "Enables verbose diagnostics", global = true)]
2726
pub(crate) verbose: bool,
2827

29-
#[structopt(
28+
#[clap(
3029
long = "quiet",
3130
help = "Prevents unnecessary output",
3231
global = true,
@@ -35,8 +34,8 @@ pub(crate) struct Volta {
3534
)]
3635
pub(crate) quiet: bool,
3736

38-
#[structopt(
39-
short = "v",
37+
#[clap(
38+
short = 'v',
4039
long = "version",
4140
help = "Prints the current version of Volta"
4241
)]
@@ -61,32 +60,32 @@ impl Volta {
6160
}
6261
}
6362

64-
#[derive(StructOpt)]
63+
#[derive(clap::Subcommand)]
6564
pub(crate) enum Subcommand {
6665
/// Fetches a tool to the local machine
67-
#[structopt(name = "fetch")]
66+
#[clap(name = "fetch")]
6867
Fetch(command::Fetch),
6968

7069
/// Installs a tool in your toolchain
71-
#[structopt(name = "install")]
70+
#[clap(name = "install")]
7271
Install(command::Install),
7372

7473
/// Uninstalls a tool from your toolchain
75-
#[structopt(name = "uninstall")]
74+
#[clap(name = "uninstall")]
7675
Uninstall(command::Uninstall),
7776

7877
/// Pins your project's runtime or package manager
79-
#[structopt(name = "pin")]
78+
#[clap(name = "pin")]
8079
Pin(command::Pin),
8180

8281
/// Displays the current toolchain
83-
#[structopt(name = "list", alias = "ls")]
82+
#[clap(name = "list", alias = "ls")]
8483
List(command::List),
8584

8685
/// Generates Volta completions
87-
#[structopt(
86+
#[clap(
8887
name = "completions",
89-
setting = structopt::clap::AppSettings::ArgRequiredElseHelp,
88+
setting = clap::AppSettings::ArgRequiredElseHelp,
9089
long_about = "Generates Volta completions
9190
9291
By default, completions will be generated for the value of your current shell,
@@ -100,25 +99,25 @@ otherwise, they will be written to `stdout`.
10099
Completions(command::Completions),
101100

102101
/// Locates the actual binary that will be called by Volta
103-
#[structopt(name = "which")]
102+
#[clap(name = "which")]
104103
Which(command::Which),
105104

106-
#[structopt(
105+
#[clap(
107106
name = "use",
108107
long_about = crate::command::r#use::USAGE,
109-
setting = structopt::clap::AppSettings::Hidden,
108+
setting = clap::AppSettings::Hidden,
110109
)]
111110
Use(command::Use),
112111

113112
/// Enables Volta for the current user / shell
114-
#[structopt(name = "setup")]
113+
#[clap(name = "setup")]
115114
Setup(command::Setup),
116115

117116
/// Run a command with custom Node, npm, pnpm, and/or Yarn versions
118-
#[structopt(
117+
#[clap(
119118
name = "run",
120-
setting = structopt::clap::AppSettings::AllowLeadingHyphen,
121-
setting = structopt::clap::AppSettings::TrailingVarArg,
119+
setting = clap::AppSettings::AllowLeadingHyphen,
120+
setting = clap::AppSettings::TrailingVarArg,
122121
)]
123122
Run(command::Run),
124123
}

0 commit comments

Comments
 (0)