Shell completion
Add the line for your shell to its startup file:
# bash: ~/.bashrc
eval "$(source-coop completions bash)"
# zsh: ~/.zshrc, after compinit
eval "$(source-coop completions zsh)"
# fish: ~/.config/fish/config.fish
source-coop completions fish | source
# elvish: ~/.config/elvish/rc.elv
eval (source-coop completions elvish | slurp)
# PowerShell: $PROFILE
source-coop completions powershell | Out-String | Invoke-Expression
TAB then completes commands, flags, flag values and record names:
source-coop product view my-org/<TAB>shows the products ofmy-org. Before the/, it shows the accounts that you are a member of.source-coop service-account view my<TAB>shows full service account IDs, such asmy-org--nightly-sync. It does not complete the ID of a new service account forcreate.
How completion works:
- It always matches the installed version. On each TAB, the script runs
source-coopwithSOURCE_COOP_COMPLETEset. - Names come from the API, as you. Completion uses your session's access token (or
SOURCE_TOKEN) and never renews it. When the token has expired, only public products complete. The next command that you run renews it. - It reads the environment only. It uses
SOURCE_API_URLandSOURCE_PROXY_URL. It ignores--api-urland--proxy-urlon the command line. - It waits 2 seconds for the API. After that, it shows no names, and bash shows file names.
- On macOS, the keychain can ask for your password. TAB waits up to one minute for you. Select Always Allow so that it does not ask again until you install a new build.