Use argv[0] for usage output
Usage messages traditionally use this as it contains the path that the user provided to run the executable (e.g. `rustfmt` instead of `/usr/local/bin/rustfmt`).
This commit is contained in:
parent
f09aa85798
commit
d7b331bea7
1 changed files with 1 additions and 1 deletions
|
@ -164,7 +164,7 @@ fn main() {
|
|||
fn print_usage(opts: &Options, reason: &str) {
|
||||
let reason = format!("{}\nusage: {} [options] <file>...",
|
||||
reason,
|
||||
env::current_exe().unwrap().display());
|
||||
env::args_os().next().unwrap().to_string_lossy());
|
||||
println!("{}", opts.usage(&reason));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue