Shell Autocomplete
Set up tab completion for devsync commands in bash and zsh.
Devsync supports shell autocomplete for bash, zsh, and powershell. Once set up, pressing Tab will complete command names, flags, and subcommand arguments.
Generating the Completion Script
Section titled “Generating the Completion Script”Devsync can print a shell-specific completion script to stdout:
devsync autocomplete bashdevsync autocomplete zshdevsync autocomplete powershellThe output is a shell script that you source in your shell’s startup file to enable completion.
Add the following line to your ~/.bashrc:
eval "$(devsync autocomplete bash)"Then reload your shell:
source ~/.bashrcAdd the following line to your ~/.zshrc:
eval "$(devsync autocomplete zsh)"Then reload your shell:
source ~/.zshrcRun the following to append the completion script to your PowerShell profile:
devsync autocomplete powershell >> $PROFILEThen reload your profile:
. $PROFILEWhat Gets Completed
Section titled “What Gets Completed”After setup, Tab completion works for:
- Top-level commands:
push,pull,track,untrack,status,init,doctor,cd,profile,autocomplete - Subcommands:
profile list,profile use - Flags:
--mode,--profile,--dry-run,--verbose, etc. - Flag values:
--modecompletes tonormal,secret,ignore
Tracking Your Completion Script with devsync
Section titled “Tracking Your Completion Script with devsync”If you track your .bashrc or .zshrc with devsync, the eval line will be synced automatically to new machines. After pulling on a new machine, the autocomplete will work as soon as you reload your shell.
devsync track ~/.zshrc