Activate Bash Autocomplete

Get faster access to available commands by activating bash completion in CLI mode.

STEP 1: Preparation

Make sure you are inside a virtual environment with Open Federated Learning (OpenFL) installed. See Install the Package for details.

STEP 2: Create the Script


Perform this procedure if you don’t have a ~/ script or if the existing ~/ script is corrupted.

  1. Create the script.

    _FX_COMPLETE=bash_source fx > ~/
  2. Check that the script was created properly.

    cat ~/

The output should look like the example below (Click==8.0.1), but could be different depend on Click version:

_fx_completion() {
    local IFS=$'\n'
    local response

    response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _FX_COMPLETE=bash_complete $1)

    for completion in $response; do
        IFS=',' read type value <<< "$completion"

        if [[ $type == 'dir' ]]; then
            compopt -o dirnames
        elif [[ $type == 'file' ]]; then
            compopt -o default
        elif [[ $type == 'plain' ]]; then

    return 0

_fx_completion_setup() {
    complete -o nosort -F _fx_completion fx


STEP 3: Activate the Autocomplete Feature

Perform this command every time you open a new terminal window.

source ~/

To save time, add the script into .bashrc so the script is activated when you log in.

  1. Edit the .bashrc file. The nano command line editor is used in this example.

    nano ~/.bashrc
  2. Add the script.

    . ~/
  3. Save your changes.

  4. Open a new terminal to use the updated bash shell.