"""
This is not needed to use vex.
It just lets us provide a convenient mechanism for people
with popular shells to set up autocompletion.
"""
import sys
import os

_HERE = os.path.dirname(os.path.abspath(__file__))

_SHELLS = {
}


def emit_shell_config_for(shell, vexrc, environ):
    function = _SHELLS.get(shell)
    if function:
        if hasattr(sys.stdout, 'buffer'):
            out = sys.stdout.buffer
        else:
            out = sys.stdout
        function(out, vexrc, environ)

@@ -215,18 +215,396 @@
 )%0A%0A_
-SHELLS = %7B
+BASH_CONFIG = b%22%22%0Awith open(os.path.join(_HERE, 'shell_configs', 'bash'), 'rb') as inp:%0A    _BASH_CONFIG = inp.read()%0A%0A%0Adef bash_config(out, vexrc, environ):%0A    ve_base = vexrc.get_ve_base(environ).encode('ascii')%0A    if ve_base:%0A        data =_BASH_CONFIG.replace(b'$WORKON_HOME', ve_base)%0A    else:%0A        data = _BASH_CONFIG%0A    out.write(data)%0A%0A%0A_SHELLS = %7B%0A    'bash': bash_config,
 %0A%7D%0A%0A

add --shell-config bash