pub fn parse(&mut self, args: &[String]) -> Result<()> {
        // Skipping the first element of `args` as it is the name of the binary.
        let (args, extra_args) = Arguments::split_args(&args[1..]);
        self.extra_args = extra_args.to_vec();

        // If `--help` is provided as a parameter, we artificially skip the parsing of other
        // command line arguments by adding just the help argument to the parsed list and
        // returning.
        if args.contains(&HELP_ARG.to_string()) {
            let mut help_arg = Argument::new("help").help("Show the help message.");
            help_arg.user_value = Some(Value::Bool(true));
            self.insert_arg(help_arg);
            return Ok(());
        }

        // If `--version` is provided as a parameter, we artificially skip the parsing of other
        // command line arguments by adding just the version argument to the parsed list and
        // returning.
        if args.contains(&VERSION_ARG.to_string()) {
            let mut version_arg = Argument::new("version").help("Print the binary version number.");
            version_arg.user_value = Some(Value::Bool(true));
            self.insert_arg(version_arg);
            return Ok(());
        }

        // Otherwise, we continue the parsing of the other arguments.
        self.populate_args(args)
    }
/// Clear split between the actual arguments of the process, the extra arguments if any
/// and the `--help` argument if present.
Clear split between the actual arguments of the process, the extra arguments if any
and the `--help` argument if present.
Clear split between the actual arguments of the process the extra arguments if any and the ` -- help ` argument if present .
pub fn parse(&mut self, args: &[String]) -> Result<()> {
        // Skipping the first element of `args` as it is the name of the binary.
        let (args, extra_args) = Arguments::split_args(&args[1..]);
        self.extra_args = extra_args.to_vec();
        // If `--help` is provided as a parameter, we artificially skip the parsing of other
        // command line arguments by adding just the help argument to the parsed list and
        // returning.
        if args.contains(&HELP_ARG.to_string()) {
            let mut help_arg = Argument::new("help").help("Show the help message.");
            help_arg.user_value = Some(Value::Bool(true));
            self.insert_arg(help_arg);
            return Ok(());
        }
        // If `--version` is provided as a parameter, we artificially skip the parsing of other
        // command line arguments by adding just the version argument to the parsed list and
        // returning.
        if args.contains(&VERSION_ARG.to_string()) {
            let mut version_arg = Argument::new("version").help("Print the binary version number.");
            version_arg.user_value = Some(Value::Bool(true));
            self.insert_arg(version_arg);
            return Ok(());
        }
        // Otherwise, we continue the parsing of the other arguments.
        self.populate_args(args)
    }
pub fn parse ( & mut self , args : & [ String ] ) -> Result < ( ) > { // Skipping the first element of `args` as it is the name of the binary. let ( args , extra_args ) = Arguments :: split_args ( & args [ 1 .. ] ) ; self . extra_args = extra_args . to_vec ( ) ; // If `--help` is provided as a parameter, we artificially skip the parsing of other // command line arguments by adding just the help argument to the parsed list and // returning. if args . contains ( & HELP_ARG . to_string ( ) ) { let mut help_arg = Argument :: new ( " " ) . help ( " " ) ; help_arg . user_value = Some ( Value :: Bool ( true ) ) ; self . insert_arg ( help_arg ) ; return Ok ( ( ) ) ; } // If `--version` is provided as a parameter, we artificially skip the parsing of other // command line arguments by adding just the version argument to the parsed list and // returning. if args . contains ( & VERSION_ARG . to_string ( ) ) { let mut version_arg = Argument :: new ( " " ) . help ( " " ) ; version_arg . user_value = Some ( Value :: Bool ( true ) ) ; self . insert_arg ( version_arg ) ; return Ok ( ( ) ) ; } // Otherwise, we continue the parsing of the other arguments. self . populate_args ( args ) }
Clear split between the actual arguments of the process, the extra arguments if any
and the `--help` argument if present.
Clear split between the actual arguments of the process the extra arguments if any and the ` -- help ` argument if present .
&mut self
args
&[String]