shell_command_parser

Function shell_command_parser 

Source
pub fn shell_command_parser(
    command: &str,
    status: &Status,
) -> Result<Vec<String>>
Expand description

Analyse, parse and builds arguments from a shell command. Normal commands are executed with sh -c "command" which allow redirection, pipes etc. Sudo commands are executed with sudo then sh -c "rest of the command". The password will be asked, injected into stdin and dropped somewhere else. The command isn’t executed here, we just build a list of arguments to be passed to an executer.

Some expansion are allowed to interact with the content of fm. Expanded tokens from a configured command. %s is converted into a Selected %f is converted into a Flagged %e is converted into a Extension %n is converted into a Filename %t is converted into a $TERM + custom flag. %c is converted into a Clipboard content. Everything else is left intact and wrapped into an Arg(string).

§Errors

It can fail if the command can’t be analysed or the expansion aren’t valid (see above).