pub fn command_tokens(
arguments: &[OsString],
) -> Option<(&OsString, &[OsString])>Expand description
What:
The command word and the tokens after it,
when the arguments name a command.
Option<(&OsString, &[OsString])> is “a pair of borrowed views,
or nothing”:
the word,
and the list of everything after it.
Why:
Every rule that reads a command’s own options needs exactly this split.
Taking it
from one function means no rule computes an offset of its own,
so no rule can
read the command word as one of its options by an arithmetic slip.
In TS you’d write (pseudocode):
function commandTokens(args: string[]): [word: string, region: string[]] | undefined;