4 Commits

Author SHA1 Message Date
f268c12f3f Merge pull request #117 from jimeh/improve-shell-script-formatting 2025-12-01 23:11:59 +00:00
adb008b301 style(shell): improve shell script formatting and quoting
Apply shfmt formatting and fix some schellcheck complaints.
2025-12-01 23:04:40 +00:00
9941b28063 Merge pull request #109 from plaffitt/skip-run_cmd-history
Prepend commands in run_cmd with a space to prevent them to be stored in the history
2025-02-24 21:25:18 +00:00
Paul Laffitte
68b02f07b0 Prepend commands in run_cmd with a space to prevent them to be stored in the history 2024-09-30 17:57:15 +02:00
17 changed files with 68 additions and 67 deletions

View File

@@ -214,8 +214,8 @@ load_window() {
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
window="$2" window="$2"
else else
window="${1/%.window.sh}" window="${1/%.window.sh/}"
window="${window/%.sh}" window="${window/%.sh/}"
fi fi
source "$file" source "$file"
window= window=
@@ -258,8 +258,8 @@ load_session() {
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
session="$2" session="$2"
else else
session="${1/%.session.sh}" session="${1/%.session.sh/}"
session="${session/%.sh}" session="${session/%.sh/}"
fi fi
set_default_path=true set_default_path=true
@@ -350,7 +350,6 @@ finalize_and_go_to_session() {
fi fi
} }
# #
# Internal functions # Internal functions
# #
@@ -382,7 +381,7 @@ __get_current_window_index() {
-F "#{window_active}:#{window_index}" 2> /dev/null | grep "^1:") -F "#{window_active}:#{window_index}" 2> /dev/null | grep "^1:")
if [ -n "$lookup" ]; then if [ -n "$lookup" ]; then
echo "${lookup/1:}" echo "${lookup/1:/}"
fi fi
} }

View File

@@ -1,11 +1,11 @@
calling-help() { calling-help() {
if [[ " $@ " != *" --help "* ]] && [[ " $@ " != *" -h "* ]]; then if [[ " $* " != *" --help "* ]] && [[ " $* " != *" -h "* ]]; then
return 1 return 1
fi fi
} }
calling-complete() { calling-complete() {
if [[ " $@ " != *" --complete "* ]]; then if [[ " $* " != *" --complete "* ]]; then
return 1 return 1
fi fi
} }

View File

@@ -43,4 +43,5 @@ case "$1" in
;; ;;
*) *)
exit 1 exit 1
;;
esac esac

View File

@@ -16,7 +16,8 @@ fi
shopt -s nullglob shopt -s nullglob
{ for path in ${PATH//:/$'\n'}; do {
for path in ${PATH//:/$'\n'}; do
for command in "${path}/tmuxifier-"*; do for command in "${path}/tmuxifier-"*; do
command="${command##*tmuxifier-}" command="${command##*tmuxifier-}"
echo "$command" echo "$command"

View File

@@ -24,7 +24,7 @@ has-completions() {
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "$(tmuxifier-help completions $@)" >&2 tmuxifier-help completions "$@" >&2
exit 1 exit 1
fi fi

View File

@@ -15,7 +15,7 @@ fi
if [ -n "$TMUX" ]; then if [ -n "$TMUX" ]; then
for item in $(tmuxifier-tmux list-pane -F "#{session_name}"); do for item in $(tmuxifier-tmux list-pane -F "#{session_name}"); do
echo $item echo "$item"
exit 0 exit 0
done done
fi fi

View File

@@ -22,7 +22,7 @@ if calling-complete "$@"; then
fi fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "$(tmuxifier-help edit-session $@)" >&2 tmuxifier-help edit-session "$@" >&2
exit 1 exit 1
fi fi

View File

@@ -22,7 +22,7 @@ if calling-complete "$@"; then
fi fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "$(tmuxifier-help edit-window $@)" >&2 tmuxifier-help edit-window "$@" >&2
exit 1 exit 1
fi fi

View File

@@ -64,8 +64,8 @@ Load Tmuxifier by adding the following to your ${profile}:
fi fi
# Print help if "-" argument is not given # Print help if "-" argument is not given
if [[ " $@ " != *" - "* ]]; then if [[ " $* " != *" - "* ]]; then
echo "$(tmuxifier-help init $@)" >&2 tmuxifier-help init "$@" >&2
exit 1 exit 1
fi fi

View File

@@ -30,7 +30,7 @@ if calling-complete "$@"; then
fi fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "$(tmuxifier-help load-session $@)" >&2 tmuxifier-help load-session "$@" >&2
exit 1 exit 1
fi fi

View File

@@ -26,14 +26,14 @@ if calling-complete "$@"; then
fi fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "$(tmuxifier-help load-window $@)" >&2 tmuxifier-help load-window "$@" >&2
exit 1 exit 1
fi fi
# Load runtime functions. # Load runtime functions.
source "$TMUXIFIER/lib/runtime.sh" source "$TMUXIFIER/lib/runtime.sh"
if [ ! -z $TMUX ]; then if [ ! -z "$TMUX" ]; then
session="$(tmuxifier-current-session)" session="$(tmuxifier-current-session)"
load_window "$1" load_window "$1"
else else

View File

@@ -22,7 +22,7 @@ if calling-complete "$@"; then
fi fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "$(tmuxifier-help new-session $@)" >&2 tmuxifier-help new-session "$@" >&2
exit 1 exit 1
fi fi

View File

@@ -22,7 +22,7 @@ if calling-complete "$@"; then
fi fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "$(tmuxifier-help new-window $@)" >&2 tmuxifier-help new-window "$@" >&2
exit 1 exit 1
fi fi