Skip to main content

command_word

Function command_word 

Source
pub fn command_word(stripped: &StrippedInvocation) -> &[u8] ⓘ
Expand description

What: The raw bytes of the command word of an invocation that names a command. &StrippedInvocation borrows the invocation; &[u8] borrows the word’s bytes. Why: Every later decision starts from the command word, read in one place. Gotcha: The caller must have seen that the invocation names a command; without one there is no word and this function panics.

In TS you’d write (pseudocode):

function commandWord(stripped: StrippedInvocation): string { return stripped.args[stripped.layout.prefixLen]; }