This section explains how to enable automatic command completion for the qq CLI and for command aliases.
The qq
CLI supports Python argparse completion that helps you use the CLI more effectively. This section explains how to enable automatic command completion for the qq
CLI and for command aliases.
The following procedures apply to running the
qq
CLI on Linux, macOS, and Windows Subsystem for Linux. Don’t run these commands on Qumulo nodesTo Enable Autocomplete for the qq CLI
-
Install the
argcomplete
Python package.pip install argcomplete
Note
Qumulo Core supportsargcomplete
2.0.0 and higher. -
Activate the
argcomplete
package.sudo activate-global-python-argcomplete
-
Search for any conflicting
qq
entries.complete | grep qq
If conflicting entries exist, remove them by specifying the entry name or path. For example:
complete -r /my/path
-
To enable autocompletion for the
qq
CLI, add the following line to the end of your shell profile (.bashrc
,.bash_profile
, and so on).eval "$(register-python-argcomplete qq)"
-
Reload your shell profile.
source ~/.bashrc
You can now use the Tab key to autocomplete qq
CLI commands. The qq
CLI supports autocomplete for all CLI arguments and Qumulo REST API command arguments.
Enabling Autocomplete for qq CLI Command Aliases
To eliminate the need to repeatedly enter qq
CLI flags (such as --host
or --credentials-store
), for example when dealing with multiple Qumulo clusters, you can add aliases for qq
CLI commands to your shell profile. In the following example, we alias a complex qq
CLI command to the simple alias qqcreds
.
alias qqcreds='qq --host my.qumulo.com --credentials-store ~/.my_creds'
When you reload your profile, you can append a parameter to the complex command by appending it to the alias. For example:
qqcreds my_credentials
To ensure that your argcomplete
configuration works with qq
CLI command aliases, you must perform additional configuration and add a third-party helper script to your system.
Before you begin, review the source code of the complete-alias helper script. Qumulo doesn’t contribute to, maintain, or take responsibility for this script.
To Enable Autocomplete for qq CLI Command Aliases
-
Add a
qq
CLI command alias and theCOMPAL_AUTO_UNMASK
configuration parameter to your shell profile (.bashrc
,.bash_profile
, and so on). For example:#qq CLI Autocomplete eval "$(register-python-argcomplete qq)" COMPAL_AUTO_UNMASK=1 source ~/.bash_completion.d/complete_alias
Tip
Don’t reload your shell profile yet. -
Create a directory for the
complete-alias
daemon and download the script to it.mkdir ~/.bash_completion.d curl https://raw.githubusercontent.com/cykerway/complete-alias/master/complete_alias \ > ~/.bash_completion.d/complete_alias
-
Add your alias to the
complete_alias
file.echo "complete -F _complete_alias qqcreds" >> ~/.bash_completion.d/complete_alias
-
Search for any conflicting
complete
entries.complete | grep complete
If conflicting entries exist, remove them by specifying the entry name or path. For example:
complete -r /my/path
-
Reload your shell profile.
source ~/.bashrc
You can now use the Tab key to autocomplete qq
CLI command aliases.