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.

To Enable Autocomplete for the qq CLI

  1. Install the argcomplete Python package.

    pip install argcomplete
    
  2. Activate the argcomplete package.

    sudo activate-global-python-argcomplete
    
  3. 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
    
  4. 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)"
    
  5. 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.

To Enable Autocomplete for qq CLI Command Aliases

  1. Add a qq CLI command alias and the COMPAL_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
    
  2. 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
    
  3. Add your alias to the complete_alias file.

    echo "complete -F _complete_alias qqcreds" >> ~/.bash_completion.d/complete_alias
    
  4. 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
    
  5. Reload your shell profile.

    source ~/.bashrc
    

You can now use the Tab key to autocomplete qq CLI command aliases.