summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/core/imag/src/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/core/imag/src/main.rs b/bin/core/imag/src/main.rs
index ea62eb7b..d08f2191 100644
--- a/bin/core/imag/src/main.rs
+++ b/bin/core/imag/src/main.rs
@@ -142,12 +142,17 @@ fn get_commands() -> Result<Vec<String>> {
fn main() -> Result<()> {
// Initialize the Runtime and build the CLI
- let appname = "imag";
+ let appname = ::std::env::current_exe()?
+ .file_name()
+ .ok_or_else(|| format_err!("Program is not a file. This is a BUG, please file me."))?
+ .to_str()
+ .ok_or_else(|| format_err!("Program name is not UTF8. Whut?"))?
+ .to_string();
let version = make_imag_version!();
let about = "imag - the PIM suite for the commandline";
let commands = get_commands()?;
let helptext = help_text(commands.clone());
- let mut app = Runtime::get_default_cli_builder(appname, &version, about)
+ let mut app = Runtime::get_default_cli_builder(&appname, &version, about)
.settings(&[AppSettings::AllowExternalSubcommands, AppSettings::ArgRequiredElseHelp])
.arg(Arg::with_name("version")
.long("version")