diff options
Diffstat (limited to 'bin/core')
-rw-r--r-- | bin/core/imag-annotate/src/main.rs | 6 | ||||
-rw-r--r-- | bin/core/imag-edit/src/main.rs | 2 | ||||
-rw-r--r-- | bin/core/imag-gps/src/main.rs | 3 | ||||
-rw-r--r-- | bin/core/imag-grep/src/main.rs | 2 | ||||
-rw-r--r-- | bin/core/imag-init/src/main.rs | 2 | ||||
-rw-r--r-- | bin/core/imag-link/src/main.rs | 2 | ||||
-rw-r--r-- | bin/core/imag-ref/src/main.rs | 1 | ||||
-rw-r--r-- | bin/core/imag/src/main.rs | 30 |
8 files changed, 27 insertions, 21 deletions
diff --git a/bin/core/imag-annotate/src/main.rs b/bin/core/imag-annotate/src/main.rs index dc82edd5..4bdd9443 100644 --- a/bin/core/imag-annotate/src/main.rs +++ b/bin/core/imag-annotate/src/main.rs @@ -94,8 +94,6 @@ fn add(rt: &Runtime) { .map_err_trace_exit_unwrap(1) .edit_content(&rt) .map_err_trace_exit_unwrap(1); - - info!("Ok"); } fn remove(rt: &Runtime) { @@ -130,8 +128,6 @@ fn remove(rt: &Runtime) { } else { debug!("Not deleting annotation object"); } - - info!("Ok"); } fn list(rt: &Runtime) { @@ -163,8 +159,6 @@ fn list(rt: &Runtime) { .collect::<Vec<_>>(); } } - - info!("Ok"); } fn list_annotation<'a>(i: usize, a: FileLockEntry<'a>, with_text: bool) { diff --git a/bin/core/imag-edit/src/main.rs b/bin/core/imag-edit/src/main.rs index 3524359c..bf05e8eb 100644 --- a/bin/core/imag-edit/src/main.rs +++ b/bin/core/imag-edit/src/main.rs @@ -80,7 +80,5 @@ fn main() { let _ = entry .edit_content(&rt) .map_err_trace_exit_unwrap(1); - - info!("Ok"); } diff --git a/bin/core/imag-gps/src/main.rs b/bin/core/imag-gps/src/main.rs index 00a8d218..eda98a19 100644 --- a/bin/core/imag-gps/src/main.rs +++ b/bin/core/imag-gps/src/main.rs @@ -138,8 +138,6 @@ fn remove(rt: &Runtime) { if scmd.is_present("print-removed") { println!("{}", removed_value); } - - info!("Ok"); } fn get(rt: &Runtime) { @@ -166,6 +164,5 @@ fn get(rt: &Runtime) { }); println!("{}", value); - info!("Ok"); } diff --git a/bin/core/imag-grep/src/main.rs b/bin/core/imag-grep/src/main.rs index c6c2c59f..9da97ae0 100644 --- a/bin/core/imag-grep/src/main.rs +++ b/bin/core/imag-grep/src/main.rs @@ -84,7 +84,7 @@ fn main() { if opts.count { println!("{}", count); - } else { + } else if !opts.files_with_matches { println!("Processed {} files, {} matches, {} nonmatches", overall_count, count, diff --git a/bin/core/imag-init/src/main.rs b/bin/core/imag-init/src/main.rs index 035d1590..5c6b3e44 100644 --- a/bin/core/imag-init/src/main.rs +++ b/bin/core/imag-init/src/main.rs @@ -128,7 +128,7 @@ fn main() { let path_str = path.to_str().map(String::from).expect("Cannot convert path to string"); let worktree = format!("--work-tree={}", path_str); - let gitdir = format!("--git-dir={}", path_str); + let gitdir = format!("--git-dir={}/.git", path_str); { let output = Command::new("git") diff --git a/bin/core/imag-link/src/main.rs b/bin/core/imag-link/src/main.rs index fe2fc091..40155f96 100644 --- a/bin/core/imag-link/src/main.rs +++ b/bin/core/imag-link/src/main.rs @@ -149,8 +149,6 @@ fn link_from_to<'a, I>(rt: &'a Runtime, from: &'a str, to: I) info!("Ok: {} -> {}", from, entry); } - - info!("Ok"); } fn remove_linking(rt: &Runtime) { diff --git a/bin/core/imag-ref/src/main.rs b/bin/core/imag-ref/src/main.rs index e781eef1..3235d1ce 100644 --- a/bin/core/imag-ref/src/main.rs +++ b/bin/core/imag-ref/src/main.rs @@ -86,7 +86,6 @@ fn add(rt: &Runtime) { match RefStore::create(rt.store(), path, flags) { Ok(r) => { debug!("Reference created: {:?}", r); - info!("Ok"); }, Err(e) => { trace_error(&e); diff --git a/bin/core/imag/src/main.rs b/bin/core/imag/src/main.rs index b569b46d..19f5308b 100644 --- a/bin/core/imag/src/main.rs +++ b/bin/core/imag/src/main.rs @@ -86,10 +86,10 @@ fn help_text(cmds: Vec<String>) -> String { /// Returns the list of imag-* executables found in $PATH fn get_commands() -> Vec<String> { - match env::var("PATH") { + let mut v = match env::var("PATH") { Err(e) => { println!("PATH error: {:?}", e); - exit(1); + exit(1) }, Ok(path) => path @@ -109,8 +109,11 @@ fn get_commands() -> Vec<String> { .and_then(|s| s.splitn(2, "-").nth(1).map(String::from)) ) }) - .collect() - } + .collect::<Vec<String>>() + }; + + v.sort(); + v } @@ -121,7 +124,7 @@ fn main() { let about = "imag - the PIM suite for the commandline"; let commands = get_commands(); let helptext = help_text(commands.clone()); - let 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") @@ -137,6 +140,23 @@ fn main() { .help("Get the versions of the imag commands")) .subcommand(SubCommand::with_name("help").help("Show help")) .after_help(helptext.as_str()); + + let long_help = { + let mut v = vec![]; + if let Err(e) = app.write_long_help(&mut v) { + eprintln!("Error: {:?}", e); + exit(1); + } + String::from_utf8(v).unwrap_or_else(|_| { eprintln!("UTF8 Error"); exit(1) }) + }; + { + let print_help = app.clone().get_matches().subcommand_name().map(|h| h == "help").unwrap_or(false); + if print_help { + println!("{}", long_help); + exit(0) + } + } + let rt = Runtime::new(app) .unwrap_or_else(|e| { println!("Runtime couldn't be setup. Exiting"); |