10
0
mirror of https://github.com/LCPQ/EMSL_Basis_Set_Exchange_Local synced 2024-10-31 19:23:42 +01:00

add durty but working autocompletion

This commit is contained in:
Thomas Applencourt 2014-11-20 11:33:00 +01:00
parent 2e3c5bac09
commit b96642a8d9

View File

@ -33,8 +33,27 @@ if ins:
path = os.path.split(os.path.abspath(sys.argv[0]))[0]
completion_function = \
"""
function _mycomplete_()
{
local word=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD -eq 1 ]; then
opt="%s"
COMPREPLY=( $(compgen -W "${opt}" -- $word))
else
COMPREPLY=()
fi
}
complete -o default -F _mycomplete_ EMSL_api.py
""" % " ".join(["get_list_basis", "get_list_elements", "get_basis_data", "get_list_formats", "create_db", "-h", "--help", "--version"])
with open(path + "/EMSL_api.rc", "w") as f:
f.write("export EMSL_API_ROOT=%s" % path + "\n")
f.write("export PYTHONPATH=${PYTHONPATH}:${EMSL_API_ROOT}/src" + "\n")
f.write(completion_function)
print "Source EMSL_api.rc, pls"