chore: format files with shfmt and resolve most shellcheck complaints

This commit is contained in:
2024-02-18 02:03:37 +00:00
parent 6cd89beb5e
commit 631e09f428
28 changed files with 160 additions and 140 deletions

View File

@@ -2,6 +2,9 @@
set -e
[ -n "$TMUXIFIER_DEBUG" ] && set -x
# Load internal utility functions.
source "$TMUXIFIER/lib/util.sh"
# Set shell to first argument that is not "-", "-h" or "--help".
for arg in "$@"; do
if [ "$arg" != "-" ] && [ "$arg" != "-h" ] && [ "$arg" != "--help" ]; then
@@ -14,46 +17,46 @@ if [ -z "$shell" ]; then
fi
case "$shell" in
bash )
profile='~/.bash_profile'
bash)
profile='.bash_profile'
;;
zsh )
profile='~/.zshrc'
zsh)
profile='.zshrc'
;;
ksh )
profile='~/.profile'
ksh)
profile='.profile'
;;
csh )
profile='~/.cshrc'
csh)
profile='.cshrc'
;;
tcsh )
profile='~/.tcshrc'
tcsh)
profile='.tcshrc'
;;
fish )
profile='~/.config/fish/config.fish'
fish)
profile='.config/fish/config.fish'
;;
* )
*)
profile='shell init file'
;;
esac
# Provide tmuxifier help
if [[ " $@ " == *" --help "* ]]; then
if calling-help "$@"; then
echo "usage: tmuxifier init -
Load Tmuxifier by adding the following to your ${profile}:
Load Tmuxifier by adding the following to your ~/${profile}:
"
case "$shell" in
csh | tcsh )
csh | tcsh)
echo " eval \`tmuxifier init -\`
"
;;
fish )
fish)
echo " eval (tmuxifier init -)
"
;;
* )
*)
echo " eval \"\$(tmuxifier init -)\"
"
;;
@@ -64,26 +67,26 @@ Load Tmuxifier by adding the following to your ${profile}:
fi
# Print help if "-" argument is not given
if [[ " $@ " != *" - "* ]]; then
echo "$(tmuxifier-help init $@)" >&2
if [[ " $* " != *" - "* ]]; then
tmuxifier-help init "$@" >&2
exit 1
fi
case "$shell" in
csh | tcsh )
csh | tcsh)
echo "setenv TMUXIFIER \"$TMUXIFIER\";"
echo "source \"\$TMUXIFIER/init.tcsh\";"
;;
fish )
fish)
echo "set -gx TMUXIFIER \"$TMUXIFIER\";"
# fish shell 2.0.0 does not have the source alias
if [[ $(fish --version 2>&1 | awk -F'version ' '{print $2}') = '2.0.0' ]]; then
echo ". \"\$TMUXIFIER/init.fish\";"
else
echo "source \"\$TMUXIFIER/init.fish\";"
fi
fi
;;
* )
*)
echo "export TMUXIFIER=\"$TMUXIFIER\";"
echo "source \"\$TMUXIFIER/init.sh\";"
;;