Skip to main content

Module completions

Module completions 

Source
Expand description

The shell completion model. The model exists only for clap_complete::generate: it never parses an argument line, and it mirrors the grammar table on CommandWord (scope, flags, positionals), so the generated scripts cannot drift from the hand dispatcher.

The bash script needs a workaround. clap_complete 4.6.11 (aot/shells/bash.rs) derives the function name from bin_name.replace('-', "__") but the case labels from replace('-', CMD_SEP), so for a binary whose name contains a hyphen the state labels name a function path that is never reached. script rewrites the label back. Remove once upstream names them consistently.

Constantsยง

SHELL_NAMES ๐Ÿ”’

Functionsยง

command_model ๐Ÿ”’
flag ๐Ÿ”’
model ๐Ÿ”’
The completion model; callers build it.
parse_shell ๐Ÿ”’
The exact lower-case spelling only.
script ๐Ÿ”’
The completion script for shell, as the text to print.