Files
tmuxifier/libexec/tmuxifier-init

64 lines
1.1 KiB
Bash
Executable File

#! /usr/bin/env bash
set -e
[ -n "$TMUXIFIER_DEBUG" ] && set -x
if [ "$1" == "-" ] || [ "$1" == "--help" ]; then
shell="$2"
else
shell="$1"
fi
if [ -z "$shell" ]; then
shell="$(basename "$SHELL")"
fi
case "$shell" in
bash )
profile='~/.bash_profile'
;;
zsh )
profile='~/.zshrc'
;;
ksh )
profile='~/.profile'
;;
csh )
profile='~/.cshrc'
;;
tcsh )
profile='~/.tcshrc'
;;
* )
profile='your shell init file'
;;
esac
# Provide tmuxifier help
if [[ " $@ " == *" --help "* ]]; then
echo "usage: tmuxifier init -
Load Tmuxifier by adding the following to your ${profile}:
eval \"\$(tmuxifier init -)\"
You might also need to add Tmuxifier's bin directory to your PATH."
exit
fi
# Print help if "-" argument is not given
if [[ " $@ " != *" - "* ]]; then
echo "$(tmuxifier-help init $@)" >&2
exit 1
fi
case "$shell" in
csh | tcsh )
echo "setenv TMUXIFIER \"$TMUXIFIER\""
echo "source \"\$TMUXIFIER/init.tcsh\""
;;
* )
echo "export TMUXIFIER=\"$TMUXIFIER\""
echo "source \"\$TMUXIFIER/init.sh\""
;;
esac