mirror of
https://github.com/clap-rs/clap
synced 2025-01-18 23:53:54 +00:00
fix: flush the buffer in App::print_version()
This commit is contained in:
parent
320209c952
commit
cbc42a37d2
1 changed files with 4 additions and 2 deletions
|
@ -1845,10 +1845,12 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
// Print the binary name if existing, but replace all spaces with hyphens in case we're
|
// Print the binary name if existing, but replace all spaces with hyphens in case we're
|
||||||
// dealing with subcommands i.e. git mv is translated to git-mv
|
// dealing with subcommands i.e. git mv is translated to git-mv
|
||||||
writeln!(w, "{} {}", &self.bin_name.clone().unwrap_or(
|
try!(writeln!(w, "{} {}", &self.bin_name.clone().unwrap_or(
|
||||||
self.name.clone())[..].replace(" ", "-"),
|
self.name.clone())[..].replace(" ", "-"),
|
||||||
self.version.unwrap_or("")
|
self.version.unwrap_or("")
|
||||||
)
|
));
|
||||||
|
|
||||||
|
w.flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reports and error to stderr along with an optional usage statement and optionally quits
|
// Reports and error to stderr along with an optional usage statement and optionally quits
|
||||||
|
|
Loading…
Reference in a new issue