Skip to content

Commit d500051

Browse files
committed
WIP: fix(cli): Make --help easier to browse
This mirrors some of the categories from `cargo help` (the man pages).
1 parent e2fbcd9 commit d500051

File tree

33 files changed

+545
-390
lines changed

33 files changed

+545
-390
lines changed

src/bin/cargo/commands/bench.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ pub fn cli() -> Command {
1616
.num_args(0..)
1717
.last(true),
1818
)
19+
.arg_package_spec(
20+
"Package to run benchmarks for",
21+
"Benchmark all packages in the workspace",
22+
"Exclude packages from the benchmark",
23+
)
24+
.arg_features()
1925
.arg_targets_all(
2026
"Benchmark only this package's library",
2127
"Benchmark only the specified binary",
@@ -29,14 +35,8 @@ pub fn cli() -> Command {
2935
"Benchmark all targets",
3036
)
3137
.arg(flag("no-run", "Compile, but don't run benchmarks"))
32-
.arg_package_spec(
33-
"Package to run benchmarks for",
34-
"Benchmark all packages in the workspace",
35-
"Exclude packages from the benchmark",
36-
)
3738
.arg_jobs()
3839
.arg_profile("Build artifacts with the specified profile")
39-
.arg_features()
4040
.arg_target_triple("Build for the target triple")
4141
.arg_target_dir()
4242
.arg_manifest_path()

src/bin/cargo/commands/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn cli() -> Command {
1313
"Build all packages in the workspace",
1414
"Exclude packages from the build",
1515
)
16+
.arg_features()
1617
.arg_jobs()
1718
.arg_targets_all(
1819
"Build only this package's library",
@@ -28,7 +29,6 @@ pub fn cli() -> Command {
2829
)
2930
.arg_release("Build artifacts in release mode, with optimizations")
3031
.arg_profile("Build artifacts with the specified profile")
31-
.arg_features()
3232
.arg_target_triple("Build for the target triple")
3333
.arg_target_dir()
3434
.arg(

src/bin/cargo/commands/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn cli() -> Command {
1313
"Check all packages in the workspace",
1414
"Exclude packages from the check",
1515
)
16+
.arg_features()
1617
.arg_jobs()
1718
.arg_targets_all(
1819
"Check only this package's library",
@@ -28,7 +29,6 @@ pub fn cli() -> Command {
2829
)
2930
.arg_release("Check artifacts in release mode, with optimizations")
3031
.arg_profile("Check artifacts with the specified profile")
31-
.arg_features()
3232
.arg_target_triple("Check for the target triple")
3333
.arg_target_dir()
3434
.arg_manifest_path()

src/bin/cargo/commands/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn cli() -> Command {
1717
"Document all packages in the workspace",
1818
"Exclude packages from the build",
1919
)
20+
.arg_features()
2021
.arg(flag(
2122
"no-deps",
2223
"Don't build documentation for dependencies",
@@ -32,7 +33,6 @@ pub fn cli() -> Command {
3233
)
3334
.arg_release("Build artifacts in release mode, with optimizations")
3435
.arg_profile("Build artifacts with the specified profile")
35-
.arg_features()
3636
.arg_target_triple("Build for the target triple")
3737
.arg_target_dir()
3838
.arg_manifest_path()

src/bin/cargo/commands/fix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub fn cli() -> Command {
1111
"Fix all packages in the workspace",
1212
"Exclude packages from the fixes",
1313
)
14+
.arg_features()
1415
.arg_jobs()
1516
.arg_targets_all(
1617
"Fix only this package's library",
@@ -26,7 +27,6 @@ pub fn cli() -> Command {
2627
)
2728
.arg_release("Fix artifacts in release mode, with optimizations")
2829
.arg_profile("Build artifacts with the specified profile")
29-
.arg_features()
3030
.arg_target_triple("Fix for the target triple")
3131
.arg_target_dir()
3232
.arg_manifest_path()

src/bin/cargo/commands/package.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ pub fn cli() -> Command {
2525
"allow-dirty",
2626
"Allow dirty working directories to be packaged",
2727
))
28-
.arg_target_triple("Build for the target triple")
29-
.arg_target_dir()
30-
.arg_features()
3128
.arg_package_spec_no_all(
3229
"Package(s) to assemble",
3330
"Assemble all packages in the workspace",
3431
"Don't assemble specified packages",
3532
)
33+
.arg_features()
34+
.arg_target_triple("Build for the target triple")
35+
.arg_target_dir()
3636
.arg_manifest_path()
3737
.arg_jobs()
3838
.after_help("Run `cargo help package` for more detailed information.\n")

src/bin/cargo/commands/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ pub fn cli() -> Command {
2727
"Name of the example target to run",
2828
)
2929
.arg_package("Package with the target to run")
30+
.arg_features()
3031
.arg_jobs()
3132
.arg_release("Build artifacts in release mode, with optimizations")
3233
.arg_profile("Build artifacts with the specified profile")
33-
.arg_features()
3434
.arg_target_triple("Build for the target triple")
3535
.arg_target_dir()
3636
.arg_manifest_path()

src/bin/cargo/commands/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn cli() -> Command {
1616
.trailing_var_arg(true),
1717
)
1818
.arg_package("Package to build")
19+
.arg_features()
1920
.arg_jobs()
2021
.arg_targets_all(
2122
"Build only this package's library",
@@ -31,7 +32,6 @@ pub fn cli() -> Command {
3132
)
3233
.arg_release("Build artifacts in release mode, with optimizations")
3334
.arg_profile("Build artifacts with the specified profile")
34-
.arg_features()
3535
.arg_target_triple("Target triple which compiles will be for")
3636
.arg(
3737
opt(

src/bin/cargo/commands/rustdoc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn cli() -> Command {
1717
"Opens the docs in a browser after the operation",
1818
))
1919
.arg_package("Package to document")
20+
.arg_features()
2021
.arg_jobs()
2122
.arg_targets_all(
2223
"Build only this package's library",
@@ -32,7 +33,6 @@ pub fn cli() -> Command {
3233
)
3334
.arg_release("Build artifacts in release mode, with optimizations")
3435
.arg_profile("Build artifacts with the specified profile")
35-
.arg_features()
3636
.arg_target_triple("Build for the target triple")
3737
.arg_target_dir()
3838
.arg_manifest_path()

src/bin/cargo/commands/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ pub fn cli() -> Command {
4444
"Test all packages in the workspace",
4545
"Exclude packages from the test",
4646
)
47+
.arg_features()
4748
.arg_jobs()
4849
.arg_release("Build artifacts in release mode, with optimizations")
4950
.arg_profile("Build artifacts with the specified profile")
50-
.arg_features()
5151
.arg_target_triple("Build for the target triple")
5252
.arg_target_dir()
5353
.arg_manifest_path()

0 commit comments

Comments
 (0)