RUSH_COMPLETE(1)

NAME

rush_complete - emit completion candidates and inspect completion context.

SYNOPSIS

rush_complete candidate value [--kind kind] [--description text] [--priority n] [--no-space]
rush_complete files
rush_complete directories [--append-slash]
rush_complete aliases
rush_complete variables
rush_complete functions
rush_complete jobs
rush_complete option-present (--long name | --short name)
rush_complete option-values (--long name | --short name)
rush_complete operand index

DESCRIPTION

rush_complete is the Rush completion provider API. It is intended for functions referenced by completion manifests, not for ordinary interactive commands. A provider function runs in a hidden captured completion context. Calls to rush_complete candidate, rush_complete files, rush_complete directories, and shell-state list commands append candidates to the current completion result.

Outside a completion provider invocation, rush_complete exits with a usage error because there is no provider context to receive candidates.

COMMANDS

candidate
Add one candidate. Supported kinds include plain, file, directory, subcommand, option, variable, function, command, and builtin. --priority accepts a signed 8-bit integer. Higher values prefer a candidate among otherwise comparable matches; Rush still performs final query-aware ordering. Omit it for priority 0, use small positive bands for contextual preference, and negative values are allowed specifically to derank fallback candidates.
files
Add path candidates matching the current completion prefix.
directories
Add directory candidates matching the current completion prefix.
aliases
Add alias-name candidates from the current shell state.
variables
Add variable-name candidates from the current shell state.
functions
Add function-name candidates from the current shell state.
jobs
Add job-spec candidates for active jobs in the current shell state.
option-present
Exit zero when the selected option is present in the parsed command line.
option-values
Print values already provided for the selected option, one per line.
operand
Print the parsed positional operand at the zero-based index.

CONTEXT VARIABLES

rush_completion_argument_index
Zero-based positional argument index being completed.
rush_completion_options_terminated
true when -- has been parsed, otherwise false.
rush_completion_value_position
value while completing an option value, otherwise item.

EXAMPLE

__rush_complete_git_branches() {
  git branch --format='%(refname:short)' 2>/dev/null |
    while read ref; do
      test -n "$ref" && rush_complete candidate "$ref" --kind plain --description branch
    done
}

SEE ALSO

rush-builtins(7), Writing completions, Completion manifest schema.