fn exec_match<F>(
    clap: &RefCell<App<'static, 'static>>,
    env: &mut Env,
    args: &mut Iterator<Item = &str>,
    writer: &mut ClickWriter,
    func: F,
) -> bool
where
    F: FnOnce(ArgMatches, &mut Env, &mut ClickWriter) -> (),
{
    // TODO: Should be able to not clone and use get_matches_from_safe_borrow, but
    // that causes weird errors involving conflicting arguments being used
    // between invocations of commands
    match clap.borrow_mut().clone().get_matches_from_safe(args) {
        Ok(matches) => {
            func(matches, env, writer);
            true
        }
        Err(err) => {
            println!("{}", err.message);
            false
        }
    }
}
/// Run specified closure with the given matches, or print error.  Return true if execed,
/// false on err
Run specified closure with the given matches, or print error.  Return true if execed,
false on err
Run specified closure with the given matches or print error . Return true if execed false on err
fn exec_match<F>(
    clap: &RefCell<App<'static, 'static>>,
    env: &mut Env,
    args: &mut Iterator<Item = &str>,
    writer: &mut ClickWriter,
    func: F,
) -> bool
where
    F: FnOnce(ArgMatches, &mut Env, &mut ClickWriter) -> (),
{
    // TODO: Should be able to not clone and use get_matches_from_safe_borrow, but
    // that causes weird errors involving conflicting arguments being used
    // between invocations of commands
    match clap.borrow_mut().clone().get_matches_from_safe(args) {
        Ok(matches) => {
            func(matches, env, writer);
            true
        }
        Err(err) => {
            println!("{}", err.message);
            false
        }
    }
}
fn exec_match < F > ( clap : & RefCell < App < ' static , ' static > > , env : & mut Env , args : & mut Iterator < Item = & str > , writer : & mut ClickWriter , func : F , ) -> bool where F : FnOnce ( ArgMatches , & mut Env , & mut ClickWriter ) -> ( ) , { // TODO: Should be able to not clone and use get_matches_from_safe_borrow, but // that causes weird errors involving conflicting arguments being used // between invocations of commands match clap . borrow_mut ( ) . clone ( ) . get_matches_from_safe ( args ) { Ok ( matches ) => { func ( matches , env , writer ) ; true } Err ( err ) => { println ! ( " " err message ) ; false } } }
Run specified closure with the given matches, or print error.
Run specified closure with the given matches or print error .
clap
&RefCell<App<'static, 'static>>
env
&mut Env
args
&mut Iterator<Item = &str>
writer
&mut ClickWriter
func
F
clap
&RefCell<App<'static, 'static>>
env
&mut Env
args
&mut Iterator<Item = &str>
writer
&mut ClickWriter
func
F