Skip to main content

announced_query

Function announced_query 

Source
pub fn announced_query(
    arguments: &[OsString],
    layout: &GlobalLayout,
) -> Option<AnnouncedQuery>
Expand description

What: Say whether the query token of an invocation is one of the four announced spellings. Option<AnnouncedQuery> is “the query, or nothing”. Why: The layout already told the caller this is a query and where it sits; only the exact token separates --version from --exec-path. Nothing else is read, so commands that are not queries pay one comparison.

In TS you’d write (pseudocode):

function announcedQuery(args: string[], layout: GlobalLayout): 'version' | 'help' | undefined;