Skip to main content

Shell Autocomplete

Stricli has first class support for tab auto completion in shells.

Rather than generate shell-specific scripts based on your application, the logic for proposing input completions is written directly into the core library. This means that the auto complete behavior will exactly match the functionality of your app.

Autocomplete Management

Part of the difficulty with setting up auto completion is getting it installed into the shell. Stricli solves this with a standalone command npx @stricli/auto-complete@latest.

USAGE
@stricli/auto-complete install [--shell bash] targetCmd autcCmd
@stricli/auto-complete uninstall [--shell bash] targetCmd
@stricli/auto-complete --help
@stricli/auto-complete --version

Manage auto-complete command installations for shells

FLAGS
-h --help Print this help information and exit
-v --version Print version information and exit

COMMANDS
install Installs target command with autocompletion for a given shell type
uninstall Uninstalls target command for a given shell type

This command allows you to configure your shell to run a secondary autcCmd command whenever auto completion is requested for the targetCmd command.

caution

At this time, the only shell that @stricli/auto-complete supports is bash. Support for other shells is planned for the future.

Adding a Built-In install Command

To simplify the process of installing the auto complete command, @stricli/auto-complete also exposes methods that allow you to build a command to be added to your own app. It is recommended to hide these so that they do not show up in any help text, but they can still be run. To see an example of this setup, check out the tutorial.