aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErwan Martin <[email protected]>2016-07-23 22:44:28 +0200
committerErwan Martin <[email protected]>2016-07-23 22:44:28 +0200
commit9a9a5d1867431782037555dec6afb322edb9c22e (patch)
treed99e0ff498b970dde3efc1ebee98c23a3149a684
parent8df33a7dc3b1f9bfd1f887567f44378021eb8851 (diff)
downloadkerl-9a9a5d1867431782037555dec6afb322edb9c22e.tar.gz
kerl-9a9a5d1867431782037555dec6afb322edb9c22e.tar.bz2
kerl-9a9a5d1867431782037555dec6afb322edb9c22e.zip
Add support for C shells.
-rw-r--r--README.md18
-rwxr-xr-xkerl50
2 files changed, 68 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4b65f31..e49648b 100644
--- a/README.md
+++ b/README.md
@@ -215,6 +215,24 @@ Deactivation is the same as in other shells:
Please note: if you've installed a build with an older version of kerl
(1.2.0 older) it won't have the `activate.fish` script.
+C shell support
+---------------
+
+kerl has basic support for the C shells (csh/tcsh/etc.).
+
+To activate an installation:
+
+ source /path/to/install/dir/activate.csh
+
+The activation script sources file .kerlrc.csh instead of .kerlrc.
+
+Deactivation is the same as in other shells:
+
+ kerl_deactivate
+
+Please note: if you've installed a build with an older version of kerl
+it won't have the `activate.csh` script.
+
Glossary
--------
diff --git a/kerl b/kerl
index ec8df79..7c7ff9f 100755
--- a/kerl
+++ b/kerl
@@ -768,6 +768,56 @@ if set --query KERL_ENABLE_PROMPT
end
end
ACTIVATE_FISH
+
+ cat <<ACTIVATE_CSH > "$absdir/activate.csh"
+# This file must be used with "source bin/activate.csh" *from csh*.
+# You cannot run it directly.
+
+alias kerl_deactivate 'test \$?_KERL_SAVED_PATH != 0 && setenv PATH "\$_KERL_SAVED_PATH" && unset _KERL_SAVED_PATH; rehash; test \$?_KERL_SAVED_MANPATH != 0 && setenv MANPATH "\$_KERL_SAVED_MANPATH" && unset _KERL_SAVED_MANPATH; test \$?_KERL_SAVED_REBAR_PLT_DIR != 0 && setenv REBAR_PLT_DIR "\$_KERL_SAVED_REBAR_PLT_DIR" && unset _KERL_SAVED_REBAR_PLT_DIR; test \$?_KERL_ACTIVE_DIR != 0 && unset _KERL_ACTIVE_DIR; test \$?_KERL_SAVED_PROMP != 0 && set prompt="\$_KERL_SAVED_PROMP" && unset _KERL_SAVED_PROMP; test "\!:*" != "nondestructive" && unalias deactivate'
+
+# Unset irrelevant variables.
+kerl_deactivate nondestructive
+
+if ( \$?REBAR_PLT_DIR ) then
+ set _KERL_SAVED_REBAR_PLT_DIR = "\$REBAR_PLT_DIR"
+else
+ set _KERL_SAVED_REBAR_PLT_DIR=""
+endif
+
+set _KERL_PATH_REMOVABLE = "$absdir/bin"
+set _KERL_SAVED_PATH = "\$PATH"
+setenv PATH "\${_KERL_PATH_REMOVABLE}:\$PATH"
+
+if ( ! \$?MANPATH ) then
+ set MANPATH = ""
+endif
+set _KERL_MANPATH_REMOVABLE = "$absdir/lib/erlang/man:$absdir/man"
+set _KERL_SAVED_MANPATH = "\$MANPATH"
+setenv MANPATH "\${_KERL_MANPATH_REMOVABLE}:\$MANPATH"
+
+setenv REBAR_PLT_DIR "$absdir"
+
+set _KERL_ACTIVE_DIR = "$absdir"
+
+if ( -f "$KERL_CONFIG.csh" ) then
+ source "$KERL_CONFIG.csh"
+endif
+
+if ( \$?KERL_ENABLE_PROMPT ) then
+ set _KERL_SAVED_PROMP = "\$prompt"
+
+ if ( \$?KERL_PROMPT_FORMAT ) then
+ set FRMT = "\$KERL_PROMPT_FORMAT"
+ else
+ set FRMT = "(%BUILDNAME%)"
+ endif
+
+ set PROMPT = \`echo "\$FRMT" | sed 's^%RELEASE%^$rel^;s^%BUILDNAME%^$1^'\`
+ set prompt = "\$PROMPT\$prompt"
+endif
+
+rehash
+ACTIVATE_CSH
if [ -n "$KERL_BUILD_DOCS" ]; then
DOC_DIR="$KERL_BUILD_DIR/$1/release_$rel/lib/erlang"
if [ -d "$DOC_DIR" ]; then