Generate completion script
To load completions:
Bash:
$ source <(tome-cli completion bash)
$ tome-cli completion bash > /etc/bash_completion.d/tome-cli
$ tome-cli completion bash > $(brew --prefix)/etc/bash_completion.d/tome-cli
Zsh:
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
$ tome-cli completion zsh > "${fpath[1]}/_tome-cli"
fish:
$ tome-cli completion fish | source
$ tome-cli completion fish > ~/.config/fish/completions/tome-cli.fish
PowerShell:
PS> tome-cli completion powershell | Out-String | Invoke-Expression
PS> tome-cli completion powershell > tome-cli.ps1
Using completions from within child scripts
Once completions discover an executable and non-ignored script, tome-cli will check if the script has TOME_COMPLETION declared in file. If so, it will attempt fetch completions from the script itself.
This is accomplished by passing --complete to the script and capturing the output.
The output syntax is newline-separated strings where each line is composed of a completion (e.g. a flag or argument), a tab character, and a description of the completion.
tome-cli completion [bash|zsh|fish|powershell]
-h, --help help for completion
-d, --debug debug logs
-e, --executable string executable name
-r, --root string root directory containing scripts (default ".")
- tome-cli - A cli tool to manage scripts as a set of subcommands