kurtosis-tech.github.io


Project maintained by kurtosis-tech Hosted on GitHub Pages — Theme by mattgraham

Adding Tab Completion

The Kurtosis CLI supports tab completion for bash, zsh, and fish via the kurtosis completion SHELL command (e.g. kurtosis completion bash). sourceing the output of the command will enable tab-completion, and adding the source command to your shell config file will enable it across shells. The instructions below will get you set up for your shell.

NOTE: As of 2022-02-21, tab completion for all commands is available but intelligent tab completion for command parameters (e.g. kurtosis enclave inspect <TAB> auto-completing enclave IDs) is still ongoing.

Bash

  1. Ensure you have Bash version >= 4.1
    1. Print your Bash version:
       echo $BASH_VERSION
      
    2. If your Bash version is less than 4.1, upgrade it:
  2. Check if you have bash-completion installed:
     type _init_completion
    
  3. If you get an error like -bash: type: _init_completion: not found, install Bash completion:
    • On Mac:
      1. Install the completion library:
         brew install bash-completion@2
        
      2. Add the following to your ~/.bash_profile:
         export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"
         [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
        
      3. Reload your shell
      4. Verify that you now have the completion installed:
         type _init_completion
        
    • On Linux, install it using the package manager for your distro using these installation instructions
  4. Source the output of kurtosis completion bash in your Bash config file:
    • On Mac, add the following to your ~/.bash_profile file:
        # Add Kurtosis tab-completion
        source <(kurtosis completion bash)
      
    • On Linux, add the following to your ~/.bashrc file:
        # Add Kurtosis tab-completion
        source <(kurtosis completion bash)
      
  5. If you have an alias set up for Kurtosis, add completion for that as well (we’ll assume the alias kt in the examples below):
    • On Mac, add the following to your ~/.bash_profile file:
        # Add tab-completion to Kurtosis alias
        complete -F __start_kurtosis kt
      
    • On Linux, add the following to your ~/.bashrc file:
        # Add tab-completion to Kurtosis alias
        complete -F __start_kurtosis kt
      
  6. Reload your shell

Zsh

  1. Add the following to your ~/.zshrc file:
     # Add Kurtosis tab-completion
     source <(kurtosis completion zsh)
    
  2. If you have an alias set up for Kurtosis, add the following to your ~/.zshrc file (we’ll assume the alias kt in this example):
     # Add tab-completion to Kurtosis alias
     compdef __start_kurtosis kt
    
  3. Reload your shell
  4. If you get an error like complete:13: command not found: compdef, add the following to the top of your ~/.zshrc and reload your shell again:
     autoload -Uz compinit
     compinit
    

Fish

  1. Add the following to your ~/.config/fish/config.fish file:
     # Add Kurtosis tab-completion
     kurtosis completion fish | source
    
  2. Reload your shell

Back to index