Skip to content

Commit 1416678

Browse files
committed
Auto merge of #12841 - epage:help, r=weihanglo
fix(help):Clarify install's positional ### What does this PR try to resolve? - That a version is accepted - That you are selecting from the source a package which led to part of the confusion in #4830 I wonder if we should rename our `CRATE` value names to `PKG`/`PACKAGE` While doing this, I decided to fix the inconsistency in how we handle value names in help. ### How should we test and review this PR? ### Additional information
2 parents 16629e6 + 5f05969 commit 1416678

File tree

34 files changed

+69
-46
lines changed

34 files changed

+69
-46
lines changed

src/bin/cargo/commands/bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub fn cli() -> Command {
1212
)
1313
.arg(
1414
Arg::new("args")
15+
.value_name("ARGS")
1516
.help("Arguments for the bench binary")
1617
.num_args(0..)
1718
.last(true),

src/bin/cargo/commands/init.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ use cargo::ops;
55
pub fn cli() -> Command {
66
subcommand("init")
77
.about("Create a new cargo package in an existing directory")
8-
.arg(Arg::new("path").action(ArgAction::Set).default_value("."))
8+
.arg(
9+
Arg::new("path")
10+
.value_name("PATH")
11+
.action(ArgAction::Set)
12+
.default_value("."),
13+
)
914
.arg_new_opts()
1015
.arg_registry("Registry to use")
1116
.arg_quiet()

src/bin/cargo/commands/install.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ use cargo_util::paths;
1616
pub fn cli() -> Command {
1717
subcommand("install")
1818
.about("Install a Rust binary. Default location is $HOME/.cargo/bin")
19-
.arg(Arg::new("crate").value_parser(parse_crate).num_args(0..))
19+
.arg(
20+
Arg::new("crate")
21+
.value_name("CRATE[@<VER>]")
22+
.help("Select the package from the given source")
23+
.value_parser(parse_crate)
24+
.num_args(0..),
25+
)
2026
.arg(
2127
opt("version", "Specify a version to install")
2228
.alias("vers")

src/bin/cargo/commands/login.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::command_prelude::*;
66
pub fn cli() -> Command {
77
subcommand("login")
88
.about("Log in to a registry.")
9-
.arg(Arg::new("token").action(ArgAction::Set))
9+
.arg(Arg::new("token").value_name("TOKEN").action(ArgAction::Set))
1010
.arg_registry("Registry to use")
1111
.arg(
1212
Arg::new("args")

src/bin/cargo/commands/new.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ use cargo::ops;
55
pub fn cli() -> Command {
66
subcommand("new")
77
.about("Create a new cargo package at <path>")
8-
.arg(Arg::new("path").action(ArgAction::Set).required(true))
8+
.arg(
9+
Arg::new("path")
10+
.value_name("PATH")
11+
.action(ArgAction::Set)
12+
.required(true),
13+
)
914
.arg_new_opts()
1015
.arg_registry("Registry to use")
1116
.arg_quiet()

src/bin/cargo/commands/owner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo_credential::Secret;
66
pub fn cli() -> Command {
77
subcommand("owner")
88
.about("Manage the owners of a crate on the registry")
9-
.arg(Arg::new("crate").action(ArgAction::Set))
9+
.arg(Arg::new("crate").value_name("CRATE").action(ArgAction::Set))
1010
.arg(
1111
multi_opt(
1212
"add",

src/bin/cargo/commands/pkgid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo::util::print_available_packages;
66
pub fn cli() -> Command {
77
subcommand("pkgid")
88
.about("Print a fully qualified package specification")
9-
.arg(Arg::new("spec").action(ArgAction::Set))
9+
.arg(Arg::new("spec").value_name("SPEC").action(ArgAction::Set))
1010
.arg_quiet()
1111
.arg_package("Argument to get the package ID specifier for")
1212
.arg_manifest_path()

src/bin/cargo/commands/run.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn cli() -> Command {
1616
.about("Run a binary or example of the local package")
1717
.arg(
1818
Arg::new("args")
19+
.value_name("ARGS")
1920
.help("Arguments for the binary or example to run")
2021
.value_parser(value_parser!(OsString))
2122
.num_args(0..)

src/bin/cargo/commands/rustc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub fn cli() -> Command {
1010
.about("Compile a package, and pass extra options to the compiler")
1111
.arg(
1212
Arg::new("args")
13+
.value_name("ARGS")
1314
.num_args(0..)
1415
.help("Extra rustc flags")
1516
.trailing_var_arg(true),

src/bin/cargo/commands/rustdoc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub fn cli() -> Command {
77
.about("Build a package's documentation, using specified custom flags.")
88
.arg(
99
Arg::new("args")
10+
.value_name("ARGS")
1011
.help("Extra rustdoc flags")
1112
.num_args(0..)
1213
.trailing_var_arg(true),

0 commit comments

Comments
 (0)