From 7cc9228839f673a22765bb90acd1c0c7d6265cc2 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 2 Jun 2013 17:51:43 +0300 Subject: [PATCH] Add early version new tmuxifier-init command --- libexec/tmuxifier-init | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 libexec/tmuxifier-init diff --git a/libexec/tmuxifier-init b/libexec/tmuxifier-init new file mode 100755 index 0000000..e12edc9 --- /dev/null +++ b/libexec/tmuxifier-init @@ -0,0 +1,59 @@ +#! /usr/bin/env bash +set -e +[ -n "$TMUXIFIER_DEBUG" ] && set -x + +print="" +for args in "$@"; do + if [ "$args" = "-" ]; then + print=1 + shift + fi +done + +shell="$1" +if [ -z "$shell" ]; then + shell="$(basename "$SHELL")" +fi + +if [ -z "$print" ]; then + case "$shell" in + bash ) + profile='~/.bash_profile' + ;; + zsh ) + profile='~/.zshrc' + ;; + ksh ) + profile='~/.profile' + ;; + csh ) + profile='~/.cshrc' + ;; + tcsh ) + profile='~/.tcshrc' + ;; + * ) + profile='your profile' + ;; + esac + + { echo "# Load tmuxifier automatically by adding" + echo "# the following to ${profile}:" + echo + echo "eval \"\$(tmuxifier init -)\"" + echo + } >&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