pub fn analyze_args(args: &[&str]) -> Option<(Parameters, String)> {
    let mut params = Parameters::default();
    let mut cmd = None;

    // we skip the first one because this is the binary name
    let mut i = 1;
    while i < args.len() {
        let arg = args[i];
        let maybe_next_arg = args.get(i + 1);
        if arg.starts_with("--") || arg.starts_with("-") {
            match arg {
                "-n" | "--new-line" => params.new_line = true,
                "-e" | "--no-escape" => params.no_esc_escape = true,
                "-s" | "--escape-style" => {
                    params.escape_style =
                        EscapeStyle::from_str(maybe_next_arg.expect("Must provide escape style"))
                            .expect(
                            "You must provide an valid escape style. Type '--help' for assistance.",
                        );
                    i += 1;
                }
                "-h" | "--help" => cmd = Some("help"),
                _ => panic!("Unknown parameter '{}'! Type '--help' for assistance.", arg),
            }
        } else if cmd.is_none() {
            cmd = Some(arg);
        } else {
            panic!("Provided too many arguments/commands! Type '--help' for assistance.");
        }

        i += 1;
    }

    Some((
        params,
        cmd.expect("Provided no argument/command! Type '--help' for assistance.")
            .to_string(),
    ))
}
/// Analyzes the provided args and returns a tuple of
/// * the parameters,
/// * the command to execute.
///
/// If "help" was requested in parameter-style (e.g. `-h` or `--help`)
/// then "help" is returned as command.
Analyzes the provided args and returns a tuple of
the parameters,
the command to execute.

If "help" was requested in parameter-style
then "help" is returned as command.
Analyzes the provided args and returns a tuple of the parameters the command to execute . If " help " was requested in parameter - style then " help " is returned as command .
pub fn analyze_args(args: &[&str]) -> Option<(Parameters, String)> {
    let mut params = Parameters::default();
    let mut cmd = None;
    // we skip the first one because this is the binary name
    let mut i = 1;
    while i < args.len() {
        let arg = args[i];
        let maybe_next_arg = args.get(i + 1);
        if arg.starts_with("--") || arg.starts_with("-") {
            match arg {
                "-n" | "--new-line" => params.new_line = true,
                "-e" | "--no-escape" => params.no_esc_escape = true,
                "-s" | "--escape-style" => {
                    params.escape_style =
                        EscapeStyle::from_str(maybe_next_arg.expect("Must provide escape style"))
                            .expect(
                            "You must provide an valid escape style. Type '--help' for assistance.",
                        );
                    i += 1;
                }
                "-h" | "--help" => cmd = Some("help"),
                _ => panic!("Unknown parameter '{}'! Type '--help' for assistance.", arg),
            }
        } else if cmd.is_none() {
            cmd = Some(arg);
        } else {
            panic!("Provided too many arguments/commands! Type '--help' for assistance.");
        }
        i += 1;
    }
    Some((
        params,
        cmd.expect("Provided no argument/command! Type '--help' for assistance.")
            .to_string(),
    ))
}
pub fn analyze_args ( args : & [ & str ] ) -> Option < ( Parameters , String ) > { let mut params = Parameters :: default ( ) ; let mut cmd = None ; // we skip the first one because this is the binary name let mut i = 1 ; while i < args . len ( ) { let arg = args [ i ] ; let maybe_next_arg = args . get ( i + 1 ) ; if arg . starts_with ( " " ) || arg . starts_with ( " " ) { match arg { " " | " " => params . new_line = true , " " | " " => params . no_esc_escape = true , " " | " " => { params . escape_style = EscapeStyle :: from_str ( maybe_next_arg . expect ( " " ) ) . expect ( " " , ) ; i += 1 ; } " " | " " => cmd = Some ( " " ) , _ => panic ! ( " " arg ) , } } else if cmd . is_none ( ) { cmd = Some ( arg ) ; } else { panic ! ( " " ) ; } i += 1 ; } Some ( ( params , cmd . expect ( " " ) . to_string ( ) , ) ) }
Analyzes the provided args and returns a tuple of
 the parameters,
 the command to execute.
Analyzes the provided args and returns a tuple of the parameters the command to execute .
args
&[&str]