Skip to content

Commit 16c4741

Browse files
committed
feat: vcs, color, and message format native completion
1 parent 662213b commit 16c4741

File tree

43 files changed

+145
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+145
-128
lines changed

src/bin/cargo/cli.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,10 @@ See '<cyan,bold>cargo help</> <cyan><<command>></>' for more information on a sp
633633
)
634634
.arg(flag("quiet", "Do not print cargo log messages").short('q').global(true))
635635
.arg(
636-
opt("color", "Coloring: auto, always, never")
636+
opt("color", "Coloring")
637637
.value_name("WHEN")
638-
.global(true),
638+
.global(true)
639+
.value_parser(["auto", "always", "never"]),
639640
)
640641
.arg(
641642
Arg::new("directory")

src/bin/cargo/commands/locate_project.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ pub fn cli() -> Command {
88
.about("Print a JSON representation of a Cargo.toml file's location")
99
.arg(flag("workspace", "Locate Cargo.toml of the workspace root"))
1010
.arg(
11-
opt(
12-
"message-format",
13-
"Output representation [possible values: json, plain]",
14-
)
15-
.value_name("FMT"),
11+
opt("message-format", "Output representation")
12+
.value_name("FMT")
13+
.value_parser(["json", "plain"]),
1614
)
1715
.arg_silent_suggestion()
1816
.arg_manifest_path()

src/cargo/util/command_prelude.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,18 @@ pub trait CommandExt: Sized {
361361
}
362362

363363
fn arg_message_format(self) -> Self {
364-
self._arg(multi_opt("message-format", "FMT", "Error format"))
364+
self._arg(
365+
multi_opt("message-format", "FMT", "Error format")
366+
.value_parser([
367+
"human",
368+
"short",
369+
"json",
370+
"json-diagnostic-short",
371+
"json-diagnostic-rendered-ansi",
372+
"json-render-diagnostics",
373+
])
374+
.value_delimiter(','),
375+
)
365376
}
366377

367378
fn arg_build_plan(self) -> Self {

tests/testsuite/cargo/help/stdout.term.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testsuite/cargo_add/help/stdout.term.svg

Lines changed: 84 additions & 80 deletions
Loading

tests/testsuite/cargo_bench/help/stdout.term.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testsuite/cargo_build/help/stdout.term.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testsuite/cargo_check/help/stdout.term.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testsuite/cargo_clean/help/stdout.term.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testsuite/cargo_config/help/stdout.term.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)