Skip to content

Commit 50e1c1a

Browse files
committed
make cargo --version --verbose print extra information
Fixes #3584.
1 parent 579aa1a commit 50e1c1a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/bin/cargo.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,18 @@ fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
128128
let _token = cargo::util::job::setup();
129129

130130
if flags.flag_version {
131-
println!("{}", cargo::version());
131+
let version = cargo::version();
132+
println!("{}", version);
133+
if flags.flag_verbose > 0{
134+
println!("release: {}.{}.{}",
135+
version.major, version.minor, version.patch);
136+
if let Some(ref cfg) = version.cfg_info {
137+
if let Some(ref ci) = cfg.commit_info {
138+
println!("commit-hash: {}", ci.commit_hash);
139+
println!("commit-date: {}", ci.commit_date);
140+
}
141+
}
142+
}
132143
return Ok(None)
133144
}
134145

0 commit comments

Comments
 (0)