Skip to content

Instantly share code, notes, and snippets.

@bcl
Created July 19, 2018 03:13
Show Gist options
  • Select an option

  • Save bcl/7fee1f639a9b491c3df830cbcc4e1287 to your computer and use it in GitHub Desktop.

Select an option

Save bcl/7fee1f639a9b491c3df830cbcc4e1287 to your computer and use it in GitHub Desktop.

Revisions

  1. bcl created this gist Jul 19, 2018.
    18 changes: 18 additions & 0 deletions envon.bash_completion.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    VENV_DIR=${VENV_DIR:-~/.local/virtualenv}
    _envon()
    {
    local venvs cur

    # Get the list of environments
    venvs=$(for x in $VENV_DIR/*; do basename "$x" ; done)
    cur="${COMP_WORDS[COMP_CWORD]}"
    COMPREPLY=( $(compgen -W "${venvs}" -- ${cur}) )
    return 0
    }

    envon()
    {
    source $VENV_DIR/$1/bin/activate
    }

    complete -F _envon envon