-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #12547 - epage:install, r=weihanglo
refactor(install): Move value parsing to clap ### What does this PR try to resolve? Originally, I thought this was going to help some of my other work but it won't. Instead I decided to finish and post this PR in case there was interest since `@weihanglo` expressed interest in using `Arg::value_parser` more and this demonstrates that. ### How should we test and review this PR? A commit at a time. There seemed to be existing tests for some of the error changes.
- Loading branch information
Showing
4 changed files
with
122 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1600,8 +1600,13 @@ fn inline_version_without_name() { | |
pkg("foo", "0.1.2"); | ||
|
||
cargo_process("install @0.1.1") | ||
.with_status(101) | ||
.with_stderr("error: missing crate name for `@0.1.1`") | ||
.with_status(1) | ||
.with_stderr( | ||
"error: invalid value '@0.1.1' for '[crate]...': missing crate name before '@' | ||
For more information, try '--help'. | ||
", | ||
) | ||
.run(); | ||
} | ||
|
||
|
@@ -1612,7 +1617,7 @@ fn inline_and_explicit_version() { | |
|
||
cargo_process("install [email protected] --version 0.1.1") | ||
.with_status(101) | ||
.with_stderr("error: cannot specify both `@0.1.1` and `--version`") | ||
.with_stderr("error: cannot specify both `@<VERSION>` and `--version <VERSION>`") | ||
.run(); | ||
} | ||
|
||
|
@@ -1827,7 +1832,7 @@ fn install_empty_argument() { | |
cargo_process("install") | ||
.arg("") | ||
.with_status(1) | ||
.with_stderr_contains("[ERROR] a value is required for '[crate]...' but none was supplied") | ||
.with_stderr_contains("[ERROR] invalid value '' for '[crate]...': crate name is empty") | ||
.run(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters