Skip to content

Shell Tab Completion

Kaya-Sem edited this page Dec 5, 2024 · 5 revisions

Tab completion is currently only implemented for bash.

Bash

To get tab completion for bash, download the file located here in completions/bash_completion.sh, and source it in your .bashrc:

source /PATH/TO/bash_completion.sh

⚠️ The script currently assumes that your executable is called commandtrein. You can either rename your binary, or change the bash-file at line 14 and 19.

The completion uses the mkdir, mapfile, grep and complete commands, which should all be installed by default on your system. The completions are sourced from the commandtrein search command, and are cached in "$HOME/.config/commandtrein/" to prevent having to query for the data (~160ms) every time. Caches are updated once a week, but you can update it forcefully by removing all the cache-files: rm "$HOME/.cache/commandtrein/*.txt"

Clone this wiki locally