Shrink App setup code
This commit is contained in:
parent
fa379a2fa7
commit
58fd2dbfe4
1 changed files with 27 additions and 33 deletions
|
@ -105,16 +105,12 @@ fn main() {
|
||||||
let appname = "imag";
|
let appname = "imag";
|
||||||
let version = &version!();
|
let version = &version!();
|
||||||
let about = "imag - the PIM suite for the commandline";
|
let about = "imag - the PIM suite for the commandline";
|
||||||
let mut app = Runtime::get_default_cli_builder(appname, version, about);
|
|
||||||
|
|
||||||
let commands = get_commands();
|
let commands = get_commands();
|
||||||
|
let r = Runtime::get_default_cli_builder(appname, version, about);
|
||||||
for command in commands.iter() {
|
let matches = commands
|
||||||
let s = SubCommand::with_name(&command[..]);
|
.iter()
|
||||||
app = app.subcommand(s)
|
.fold(r, |app, cmd| app.subcommand(SubCommand::with_name(cmd)))
|
||||||
}
|
.arg(Arg::with_name("version")
|
||||||
|
|
||||||
let app = app.arg(Arg::with_name("version")
|
|
||||||
.long("version")
|
.long("version")
|
||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
.required(false)
|
.required(false)
|
||||||
|
@ -132,10 +128,8 @@ fn main() {
|
||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
.required(false)
|
.required(false)
|
||||||
.multiple(false)
|
.multiple(false)
|
||||||
.help("Show help"));
|
.help("Show help"))
|
||||||
|
.get_matches();
|
||||||
|
|
||||||
let matches = app.get_matches();
|
|
||||||
|
|
||||||
if matches.is_present("help") {
|
if matches.is_present("help") {
|
||||||
help(get_commands());
|
help(get_commands());
|
||||||
|
|
Loading…
Reference in a new issue