Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Use clap to suggest alternative argument for unsupported arguments #12529

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor(arg): rename arg_jobs to arg_parallel
  • Loading branch information
weihanglo committed Aug 22, 2023
commit ba209d6abd74c4ee85abe732ca19e1c067d77744
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/bench.rs
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ pub fn cli() -> Command {
"Benchmark all targets",
)
.arg_features()
.arg_jobs_without_keep_going()
.arg_jobs()
.arg(flag("keep-going", "Use `--no-fail-fast` instead").hide(true)) // See rust-lang/cargo#11702
.arg_profile("Build artifacts with the specified profile")
.arg_target_triple("Build for the target triple")
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/build.rs
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ pub fn cli() -> Command {
.arg_features()
.arg_release("Build artifacts in release mode, with optimizations")
.arg_profile("Build artifacts with the specified profile")
.arg_jobs()
.arg_parallel()
.arg_target_triple("Build for the target triple")
.arg_target_dir()
.arg(
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/check.rs
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ pub fn cli() -> Command {
"Check all targets",
)
.arg_features()
.arg_jobs()
.arg_parallel()
.arg_release("Check artifacts in release mode, with optimizations")
.arg_profile("Check artifacts with the specified profile")
.arg_target_triple("Check for the target triple")
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/doc.rs
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ pub fn cli() -> Command {
"Document only the specified example",
"Document all examples",
)
.arg_jobs()
.arg_parallel()
.arg_release("Build artifacts in release mode, with optimizations")
.arg_profile("Build artifacts with the specified profile")
.arg_target_triple("Build for the target triple")
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/fix.rs
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ pub fn cli() -> Command {
"Fix all targets (default)",
)
.arg_features()
.arg_jobs()
.arg_parallel()
.arg_release("Fix artifacts in release mode, with optimizations")
.arg_profile("Build artifacts with the specified profile")
.arg_target_triple("Fix for the target triple")
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ pub fn cli() -> Command {
"Install all examples",
)
.arg_features()
.arg_jobs()
.arg_parallel()
.arg(flag(
"debug",
"Build in debug mode (with the 'dev' profile) instead of release mode",
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/package.rs
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ pub fn cli() -> Command {
.arg_features()
.arg_target_triple("Build for the target triple")
.arg_target_dir()
.arg_jobs()
.arg_parallel()
.arg_manifest_path()
.after_help("Run `cargo help package` for more detailed information.\n")
}
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/publish.rs
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ pub fn cli() -> Command {
.arg_quiet()
.arg_package("Package to publish")
.arg_features()
.arg_jobs()
.arg_parallel()
.arg_target_triple("Build for the target triple")
.arg_target_dir()
.arg_manifest_path()
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/run.rs
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ pub fn cli() -> Command {
"Name of the example target to run",
)
.arg_features()
.arg_jobs()
.arg_parallel()
.arg_release("Build artifacts in release mode, with optimizations")
.arg_profile("Build artifacts with the specified profile")
.arg_target_triple("Build for the target triple")
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/rustc.rs
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ pub fn cli() -> Command {
"Build all targets",
)
.arg_features()
.arg_jobs()
.arg_parallel()
.arg_release("Build artifacts in release mode, with optimizations")
.arg_profile("Build artifacts with the specified profile")
.arg_target_triple("Target triple which compiles will be for")
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/rustdoc.rs
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ pub fn cli() -> Command {
"Build all targets",
)
.arg_features()
.arg_jobs()
.arg_parallel()
.arg_release("Build artifacts in release mode, with optimizations")
.arg_profile("Build artifacts with the specified profile")
.arg_target_triple("Build for the target triple")
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/test.rs
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ pub fn cli() -> Command {
"Test all targets (does not include doctests)",
)
.arg_features()
.arg_jobs_without_keep_going()
.arg_jobs()
.arg(flag("keep-going", "Use `--no-fail-fast` instead").hide(true)) // See rust-lang/cargo#11702
.arg_release("Build artifacts in release mode, with optimizations")
.arg_profile("Build artifacts with the specified profile")
6 changes: 3 additions & 3 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
@@ -82,8 +82,8 @@ pub trait CommandExt: Sized {
)
}

fn arg_jobs(self) -> Self {
self.arg_jobs_without_keep_going()._arg(
fn arg_parallel(self) -> Self {
self.arg_jobs()._arg(
flag(
"keep-going",
"Do not abort the build as soon as there is an error (unstable)",
@@ -92,7 +92,7 @@ pub trait CommandExt: Sized {
)
}

fn arg_jobs_without_keep_going(self) -> Self {
fn arg_jobs(self) -> Self {
self._arg(
opt("jobs", "Number of parallel jobs, defaults to # of CPUs.")
.short('j')