Declarative tool that compiles man-page-like grammars into shell completion scripts for bash, fish, zsh, and PowerShell.
Complgen is a Rust-based tool that compiles declarative, man-page-like grammars into standalone completion scripts for multiple shells including bash, fish, zsh, and PowerShell. It solves the problem of having to write and maintain separate, often complex, completion scripts for each shell by providing a single source of truth. The grammar syntax is designed to be intuitive and closely mirrors the notation used in Unix man pages.
Command-line tool developers and maintainers who need to provide high-quality shell completions for their applications across multiple shells without the overhead of writing shell-specific scripts.
Developers choose Complgen because it drastically reduces the maintenance burden of shell completions by using a single declarative grammar, supports advanced features like external command sourcing and shell-specific behaviors, and produces precise completions that follow man-page conventions.
Declarative bash/fish/zsh/pwsh completions without writing shell scripts!
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Generate completion scripts for bash, fish, zsh, and PowerShell from a single grammar file, eliminating the maintenance overhead of separate shell-specific scripts as demonstrated in the usage examples.
Grammar based on man-page notation, making it readable and maintainable, such as in examples like `grep --color=(always | never | auto);` that mirror standard documentation.
Supports external command sourcing with descriptions, shell-specific definitions via `<USER@bash>`, and within-word completions for complex patterns like `--option=ARGUMENT`, as detailed in the README.
Use the `||` operator to control which completions appear first based on input context, mimicking prioritization seen in tools like git, as explained in the fallback section.
Bash completions need the bash-completion OS package, and PowerShell requires Core 7+, adding setup complexity that may not be feasible in all environments.
Fish 4.0's fuzzy subsequence filtering does not work with complgen-generated scripts, limiting the user experience for Fish enthusiasts who rely on this feature.
Admitted caveat: non-regular grammars aren't completed 100% precisely, such as with nested parentheses in `find(1)`, which can lead to inaccurate suggestions in edge cases.