fn possible_subcommand(&self, arg_os: &RawOsStr, valid_arg_found: bool) -> Option<&str> {
        debug!("Parser::possible_subcommand: arg={:?}", arg_os);

        if !(self.cmd.is_args_conflicts_with_subcommands_set() && valid_arg_found) {
            if self.cmd.is_infer_subcommands_set() {
                // For subcommand `test`, we accepts it's prefix: `t`, `te`,
                // `tes` and `test`.
                let v = self
                    .cmd
                    .all_subcommand_names()
                    .filter(|s| RawOsStr::from_str(s).starts_with_os(arg_os))
                    .collect::<Vec<_>>();

                if v.len() == 1 {
                    return Some(v[0]);
                }

                // If there is any ambiguity, fallback to non-infer subcommand
                // search.
            }
            if let Some(sc) = self.cmd.find_subcommand(arg_os) {
                return Some(sc.get_name());
            }
        }
        None
    }
// Checks if the arg matches a subcommand name, or any of its aliases (if defined)
Checks if the arg matches a subcommand name, or any of its aliases (if defined)
Checks if the arg matches a subcommand name or any of its aliases ( if defined )
fn possible_subcommand(&self, arg_os: &RawOsStr, valid_arg_found: bool) -> Option<&str> {
        debug!("Parser::possible_subcommand: arg={:?}", arg_os);
        if !(self.cmd.is_args_conflicts_with_subcommands_set() && valid_arg_found) {
            if self.cmd.is_infer_subcommands_set() {
                // For subcommand `test`, we accepts it's prefix: `t`, `te`,
                // `tes` and `test`.
                let v = self
                    .cmd
                    .all_subcommand_names()
                    .filter(|s| RawOsStr::from_str(s).starts_with_os(arg_os))
                    .collect::<Vec<_>>();
                if v.len() == 1 {
                    return Some(v[0]);
                }
                // If there is any ambiguity, fallback to non-infer subcommand
                // search.
            }
            if let Some(sc) = self.cmd.find_subcommand(arg_os) {
                return Some(sc.get_name());
            }
        }
        None
    }
fn possible_subcommand ( & self , arg_os : & RawOsStr , valid_arg_found : bool ) -> Option < & str > { debug ! ( " " arg_os ) ; if ! ( self . cmd . is_args_conflicts_with_subcommands_set ( ) && valid_arg_found ) { if self . cmd . is_infer_subcommands_set ( ) { // For subcommand `test`, we accepts it's prefix: `t`, `te`, // `tes` and `test`. let v = self . cmd . all_subcommand_names ( ) . filter ( | s | RawOsStr :: from_str ( s ) . starts_with_os ( arg_os ) ) . collect :: < Vec < _ > > ( ) ; if v . len ( ) == 1 { return Some ( v [ 0 ] ) ; } // If there is any ambiguity, fallback to non-infer subcommand // search. } if let Some ( sc ) = self . cmd . find_subcommand ( arg_os ) { return Some ( sc . get_name ( ) ) ; } } None }
Checks if the arg matches a subcommand name, or any of its aliases (if defined)
Checks if the arg matches a subcommand name or any of its aliases ( if defined )
&self
arg_os
&RawOsStr
valid_arg_found
bool
&self
arg_os
&RawOsStr
valid_arg_found
bool