Help Center/ ModelArts/ DevEnviron/ ModelArts CLI Command Reference/ Autocompletion for ma-cli Commands
Updated on 2023-06-27 GMT+08:00

Autocompletion for ma-cli Commands

CLI autocomplete enables you to get a list of supported ma-cli commands by typing a command prefix and pressing Tab on your terminal. Autocomplete for ma-cli commands needs to be enabled in Terminal. After running the ma-cli auto-completion command, you can copy and run the commands as prompted on the current terminal to automatically complete the ma-cli commands. Bash, Fish, and Zsh shells are supported. The default shell is Bash.

Take the Bash command as an example. Run the eval "$(_MA_CLI_COMPLETE=bash_source ma-cli)" command in Terminal to enable autocomplete.
eval "$(_MA_CLI_COMPLETE=bash_source ma-cli)"

Run the ma-cli auto-completion Zsh or ma-cli auto-completion Fish command to view the autocomplete command in Zsh or Fish.

Available Commands

$ ma-cli auto-completion -h
Usage: ma-cli auto-completion [OPTIONS] [[Bash|Zsh|Fish]]

  Auto complete ma-cli command in terminal.

  Example:

  # print bash auto complete command to terminal
  ma-cli auto-completion Bash

Options:
  -H, -h, --help  Show this message and exit.

# By default, the autocomplete command for Bash is displayed.

$ ma-cli auto-completion

Tips: please paste following shell command to your terminal to activate auto complation.

[ OK ] eval "$(_MA_CLI_COMPLETE=bash_source ma-cli)"

# After the preceding command is executed, autocomplete has been enabled on the terminal.

$ eval "$(_MA_CLI_COMPLETE=bash_source ma-cli)"

# The autocomplete command for Fish is displayed.
$ ma-cli auto-completion Fish
Tips: please paste following shell command to your terminal to activate auto complation.

[ OK ] eval (env _MA_CLI_COMPLETE=fish_source ma-cli)