pub fn handle_cmd(i: CompleteStr) -> nom::IResult<CompleteStr, Cmd, CmdError> {
    do_parse!(i,
        cmd: add_return_error!(nom::ErrorKind::Custom(CmdError::InvalidCmd(i.0)), // Throws an InvalidCmd error if none of the switch cases t
                fix_error!(CmdError,
                    switch!(fix_error!(CmdError, word),
                        CompleteStr("sort") => do_parse!(
                            (Action::Sort)
                        ) |
                        CompleteStr("kill") => do_parse!(
                            (Action::Kill)
                        )
                    )
                )
        ) >>
        args: parse_args >> // Parses the remaining words as arguments
        (Cmd {
            cmd,
            args
        })
    )
}
// Parses the first word as the command and the remaining words as arguments, then runs the corresponding command
Parses the first word as the command and the remaining words as arguments, then runs the corresponding command
Parses the first word as the command and the remaining words as arguments then runs the corresponding command
pub fn handle_cmd(i: CompleteStr) -> nom::IResult<CompleteStr, Cmd, CmdError> {
    do_parse!(i,
        cmd: add_return_error!(nom::ErrorKind::Custom(CmdError::InvalidCmd(i.0)), // Throws an InvalidCmd error if none of the switch cases t
                fix_error!(CmdError,
                    switch!(fix_error!(CmdError, word),
                        CompleteStr("sort") => do_parse!(
                            (Action::Sort)
                        ) |
                        CompleteStr("kill") => do_parse!(
                            (Action::Kill)
                        )
                    )
                )
        ) >>
        args: parse_args >> // Parses the remaining words as arguments
        (Cmd {
            cmd,
            args
        })
    )
}
pub fn handle_cmd ( i : CompleteStr ) -> nom :: IResult < CompleteStr , Cmd , CmdError > { do_parse ! ( i cmd add_return_error ( nom ErrorKind Custom ( CmdError InvalidCmd ( i 0 ) ) // Throws an InvalidCmd error if none of the switch cases t fix_error ( CmdError switch ( fix_error ( CmdError word ) CompleteStr ( " " ) do_parse ( ( Action Sort ) ) CompleteStr ( " " ) do_parse ( ( Action Kill ) ) ) ) ) args parse_args // Parses the remaining words as arguments ( Cmd { cmd args } ) ) }
Parses the first word as the command and the remaining words as arguments, then runs the corresponding command
Parses the first word as the command and the remaining words as arguments then runs the corresponding command
i
CompleteStr