From f4f807bc1344c88e004b6b36af4d10f7e172a0bb Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 18 May 2016 22:26:35 +0200 Subject: [PATCH] Extract args into new helper functions --- libimagentrytag/src/ui.rs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/libimagentrytag/src/ui.rs b/libimagentrytag/src/ui.rs index ecef19d6..de0cbbfc 100644 --- a/libimagentrytag/src/ui.rs +++ b/libimagentrytag/src/ui.rs @@ -9,20 +9,26 @@ pub fn tag_subcommand<'a, 'b>() -> App<'a, 'b> { .author("Matthias Beyer ") .version("0.1") .about("Add or remove tags") + .arg(tag_add_arg()) + .arg(tag_remove_arg()) +} - .arg(Arg::with_name(tag_subcommand_add_arg_name()) - .short("a") - .long("add") - .takes_value(true) - .multiple(true) - .help("Add tags, seperated by comma or by specifying multiple times")) +pub fn tag_add_arg<'a, 'b>() -> Arg<'a, 'b> { + Arg::with_name(tag_subcommand_add_arg_name()) + .short("a") + .long("add") + .takes_value(true) + .multiple(true) + .help("Add tags, seperated by comma or by specifying multiple times") +} - .arg(Arg::with_name(tag_subcommand_remove_arg_name()) - .short("r") - .long("remove") - .takes_value(true) - .multiple(true) - .help("Remove tags, seperated by comma or by specifying multiple times")) +pub fn tag_remove_arg<'a, 'b>() -> Arg<'a, 'b> { + Arg::with_name(tag_subcommand_remove_arg_name()) + .short("r") + .long("remove") + .takes_value(true) + .multiple(true) + .help("Remove tags, seperated by comma or by specifying multiple times") } pub fn tag_subcommand_name() -> &'static str {