Configure BCECMD Command-Line Completion
Functions
As of version v0.4.6, the BCE CMD supports command-line auto-completion, which helps reduce typing effort and provides flag and sub-command suggestions. It supports auto-completion for four shells: bash, zsh, fish, and PowerShell. The subsequent instructions guide you on configuring these terminals. (Ensure the bcecmd path is added to your system path before proceeding with the configurations. The following commands assume this prerequisite.)
Bash
bcecmd can use the bcecmd completion bash command to output a bash completion script. Sourcing this script activates command-line completion function, but some preliminary bash configurations are required beforehand.
- Please ensure that your bash version is 4.1 and above.
- For MAC users, MAC supports bash up to version 3.27. Please use zsh to use the completion function.
- For Linux users, use the
apt-get install bash-completionoryum install bash-completioncommand to install bash-completion.
After completing the operations above, the system should automatically create the file /usr/share/bash-completion/bash_completion. After that, open the ~/.bashrc file, add the following commands and reboot the command line:
source /usr/share/bash-completion/bash_completionsource <(bcecmd completion bash)
Zsh
bcecmd can output bash completion scripts using the command bcecmd completion bash. Save the following command in the /.zshrc file and restart the terminal to use the command-line auto-completion function:
source <(bcecmd completion zsh)
In case of the error command not found: compdef, add the following command at the header of the ./zshrc file:
autoload -U compinit; compinit
Fish
To enable the Fish completion function, modify the ~/.config/fish/config.fish file to permanently activate the completion function. Enter the following command in this file and reboot the command line:
bcecmd completion fish | source
PowerShell
The bcecmd command-line completion of PowerShell is incomplete, it cannot complete all flag options but can provide hints of all commands and sub-commands. However, PowerShell can identify whether the format of input flag is correct. To enable PowerShell command-line completion, enter the following statement in the command line and reboot the command line:
bcecmd completion powershell >> $PROFILE
