mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Add --message-format for install
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
parent
7a947ae523
commit
6351472a80
@ -71,6 +71,7 @@ pub fn cli() -> App {
|
|||||||
.requires("crate")
|
.requires("crate")
|
||||||
.conflicts_with_all(&["git", "path", "index"]),
|
.conflicts_with_all(&["git", "path", "index"]),
|
||||||
)
|
)
|
||||||
|
.arg_message_format()
|
||||||
.after_help("Run `cargo help install` for more detailed information.\n")
|
.after_help("Run `cargo help install` for more detailed information.\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,83 @@ fn simple() {
|
|||||||
assert_has_not_installed_exe(cargo_home(), "foo");
|
assert_has_not_installed_exe(cargo_home(), "foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn simple_with_message_format() {
|
||||||
|
pkg("foo", "0.0.1");
|
||||||
|
|
||||||
|
cargo_process("install foo --message-format=json")
|
||||||
|
.with_stderr(
|
||||||
|
"\
|
||||||
|
[UPDATING] `[..]` index
|
||||||
|
[DOWNLOADING] crates ...
|
||||||
|
[DOWNLOADED] foo v0.0.1 (registry [..])
|
||||||
|
[INSTALLING] foo v0.0.1
|
||||||
|
[COMPILING] foo v0.0.1
|
||||||
|
[FINISHED] release [optimized] target(s) in [..]
|
||||||
|
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
|
||||||
|
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
|
||||||
|
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.with_json(
|
||||||
|
r#"
|
||||||
|
{
|
||||||
|
"reason": "compiler-artifact",
|
||||||
|
"package_id": "foo 0.0.1 ([..])",
|
||||||
|
"manifest_path": "[..]",
|
||||||
|
"target": {
|
||||||
|
"kind": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"crate_types": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"name": "foo",
|
||||||
|
"src_path": "[..]/foo-0.0.1/src/lib.rs",
|
||||||
|
"edition": "2015",
|
||||||
|
"doc": true,
|
||||||
|
"doctest": true,
|
||||||
|
"test": true
|
||||||
|
},
|
||||||
|
"profile": "{...}",
|
||||||
|
"features": [],
|
||||||
|
"filenames": "{...}",
|
||||||
|
"executable": null,
|
||||||
|
"fresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"reason": "compiler-artifact",
|
||||||
|
"package_id": "foo 0.0.1 ([..])",
|
||||||
|
"manifest_path": "[..]",
|
||||||
|
"target": {
|
||||||
|
"kind": [
|
||||||
|
"bin"
|
||||||
|
],
|
||||||
|
"crate_types": [
|
||||||
|
"bin"
|
||||||
|
],
|
||||||
|
"name": "foo",
|
||||||
|
"src_path": "[..]/foo-0.0.1/src/main.rs",
|
||||||
|
"edition": "2015",
|
||||||
|
"doc": true,
|
||||||
|
"doctest": false,
|
||||||
|
"test": true
|
||||||
|
},
|
||||||
|
"profile": "{...}",
|
||||||
|
"features": [],
|
||||||
|
"filenames": "{...}",
|
||||||
|
"executable": "[..]",
|
||||||
|
"fresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
{"reason":"build-finished","success":true}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
assert_has_installed_exe(cargo_home(), "foo");
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn with_index() {
|
fn with_index() {
|
||||||
pkg("foo", "0.0.1");
|
pkg("foo", "0.0.1");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user