diff options
author | Radu Ciorba <[email protected]> | 2016-06-30 11:43:13 +0300 |
---|---|---|
committer | Radu Ciorba <[email protected]> | 2016-06-30 11:43:13 +0300 |
commit | 69a7a53ba2a71de6b30bca9547787d3f9df2198d (patch) | |
tree | 4056f72af712c33b437c48f155b4c65a6da2eb33 /kerl | |
parent | b87a45d9b8bc32cf0262239c704383249739d62e (diff) | |
download | kerl-69a7a53ba2a71de6b30bca9547787d3f9df2198d.tar.gz kerl-69a7a53ba2a71de6b30bca9547787d3f9df2198d.tar.bz2 kerl-69a7a53ba2a71de6b30bca9547787d3f9df2198d.zip |
add support for fish shell
Diffstat (limited to 'kerl')
-rwxr-xr-x | kerl | 64 |
1 files changed, 64 insertions, 0 deletions
@@ -668,6 +668,70 @@ if [ -n "\$BASH" -o -n "\$ZSH_VERSION" ]; then hash -r fi ACTIVATE + + cat <<ACTIVATE_FISH > "$absdir/activate.fish" +# credits to virtualenv +function _kerl_remove_el --description 'remove element from array' + set -l new_array + for el in \$\$argv[1] + if test \$el != \$argv[2] + set new_array \$new_array \$el + end + end + set -x \$argv[1] \$new_array +end + +function kerl_deactivate --description "deactivate erlang environment" + if set --query _KERL_PATH_REMOVABLE + _kerl_remove_el PATH "\$_KERL_PATH_REMOVABLE" + set --erase _KERL_PATH_REMOVABLE + end + if set --query _KERL_MANPATH_REMOVABLE + _kerl_remove_el MANPATH "\$_KERL_MANPATH_REMOVABLE" + set --erase _KERL_MANPATH_REMOVABLE + end + if set --query _KERL_SAVED_REBAR_PLT_DIR + set -x REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" + set --erase _KERL_SAVED_REBAR_PLT_DIR + end + if set --query _KERL_ACTIVE_DIR + set --erase _KERL_ACTIVE_DIR + end + if functions --query _kerl_saved_prompt + functions --erase fish_prompt + # functions --copy complains about about fish_prompt already being defined + # so we take a page from virtualenv's book + . ( begin + printf "function fish_prompt\n\t#" + functions _kerl_saved_prompt + end | psub ) + functions --erase _kerl_saved_prompt + end + if test "\$argv[1]" != "nondestructive" + functions --erase kerl_deactivate + functions --erase _kerl_remove_el + end +end +kerl_deactivate nondestructive + +set -x _KERL_SAVED_REBAR_PLT_DIR "\$REBAR_PLT_DIR" +set -x _KERL_PATH_REMOVABLE "$absdir/bin" +set -x PATH \$PATH "\$_KERL_PATH_REMOVABLE" +set -x _KERL_MANPATH_REMOVABLE "$absdir/lib/erlang/man" "$absdir/man" +set -x MANPATH \$MANPATH "\$_KERL_MANPATH_REMOVABLE" +set -x REBAR_PLT_DIR "$absdir" +set -x _KERL_ACTIVE_DIR "$absdir" +if test -f "$KERL_CONFIG.fish" + source "$KERL_CONFIG.fish" +end +if set --query KERL_ENABLE_PROMPT + functions --copy fish_prompt _kerl_saved_prompt + function fish_prompt + echo -n "($1)" + _kerl_saved_prompt + end +end +ACTIVATE_FISH if [ -n "$KERL_BUILD_DOCS" ]; then DOC_DIR="$KERL_BUILD_DIR/$1/release_$rel/lib/erlang" if [ -d "$DOC_DIR" ]; then |