clilyruntime-aware CLI docs
Guides

Shell completions

Generate completion scripts for bash, zsh, fish, and PowerShell from the same command tree you execute.

clily treats completion generation as part of the command definition, not a separate subsystem.

Enable completions

The simplest form is:

completion: true

That enables the default completion command.

Customize the completion command

completion: {
  command: 'completion',
  aliases: ['completions'],
  shell: 'zsh',
  shells: ['zsh', 'bash', 'fish', 'pwsh'],
}

Supported shells

  • bash
  • zsh
  • fish
  • pwsh

In the current implementation, bash, zsh, and fish are powered by omelette, while PowerShell uses a native generator.

Example invocation

node --experimental-strip-types src/index.ts completion fish

Design note

Completion generation uses the existing command tree, so subcommands and schema-derived options do not need to be re-described elsewhere.

On this page