diff options
author | mario <mario-krehl@gmx.de> | 2016-09-03 12:39:21 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-09-05 16:18:11 +0200 |
commit | 1900d6922c0372aebdc5adce85f4de4cc4637b80 (patch) | |
tree | 7bf6d442312ebe905af33ae5803336be159a6d9f /bin | |
parent | a740dcd7ba40a50dccc86be1653e220514da317f (diff) |
Fix clap for external subcommands
Diffstat (limited to 'bin')
-rw-r--r-- | bin/src/main.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/bin/src/main.rs b/bin/src/main.rs index 70fd5097..f8e0ccc8 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs @@ -126,10 +126,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .multiple(false) .help("Show help")) .subcommand(SubCommand::with_name("help").help("Show help")) - .subcommands(get_commands() - .iter() - .map(|cmd| SubCommand::with_name(cmd)) - ) } fn main() { @@ -177,7 +173,7 @@ fn main() { match matches.subcommand() { (subcommand, Some(scmd)) => { - let subcommand_args : Vec<&str> = scmd.values_of(subcommand).unwrap().collect(); + let subcommand_args : Vec<&str> = scmd.values_of("").unwrap().collect(); debug!("Calling 'imag-{}' with args: {:?}", subcommand, subcommand_args); match Command::new(format!("imag-{}", subcommand)) @@ -202,6 +198,7 @@ fn main() { match e.kind() { ErrorKind::NotFound => { println!("No such command: 'imag-{}'", subcommand); + println!("See 'imag --help' for available subcommands"); exit(2); }, ErrorKind::PermissionDenied => { |