/** * Bash completion generator. Walks a CommandSpec tree and emits a single * self-contained bash function `_` plus the `complete -F _ ` * directive that registers it. The bin name is injected by the caller so the * same generator serves any host CLI. * * Generated script architecture: * 1. `__path()`: walks COMP_WORDS forward, skipping options and option * values, returns the current command-path string (e.g., "anthropic cost"). * 2. `__options()` / `__subcommands()` / `__option_takes_value()` / * `__option_choices()`: table-lookup functions, generated as big * case statements from the spec tree. * 3. `_()`: main entry. Sets COMPREPLY based on whether the cursor is * on a subcommand name, option name (--), or value. * 4. Dynamic value paths shell out to ` __complete -- "$cur"`. * * Important escaping rules: * - Single-quoted strings in bash don't honor escapes. We replace `'` in * descriptions/choices with `'\''` (the standard bash single-quote escape). * - We avoid descriptions in bash output because bash COMPREPLY can't render * them; descriptions are a zsh/fish feature. */ import type { CommandSpec } from "./walk.js"; export declare function generateBash(root: CommandSpec, binName: string): string; /** * The driver: the parts of the completion that don't depend on the command * tree. Walks COMP_WORDS to determine the current command path, then dispatches * to subcommand / option / value completion. `fn` is the function-name prefix * and `binName` is the CLI name used for the `__complete` callback. */ /** * DYNAMIC bash completion: a thin, tree-independent shim. Instead of baking the * command tree into case-tables (which go stale on any command/flag change), * it hands the live command line to ` __complete-line` on every and * lets the binary — which always knows its own current tree — answer. Install * once; never regenerate. The trailing `\x1f:` line carries the directive * bitmask (bit 0 = fall back to file completion). */ export declare function generateBashDynamic(binName: string): string; //# sourceMappingURL=bash.d.ts.map