aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-11-14 11:08:59 -0800
committerEugene Triguba <hello@eugenetriguba.com>2026-11-14 11:08:59 -0800
commit36f7df56164df73c7af867d8ed478a9b572aee40 (patch)
tree0e46940d56b58e2b473b872a8bc4fac9d69a3d33 /scripts
parentFix links to docs images in readme and update install instructions (diff)
downloadtmux-toggle-term-36f7df56164df73c7af867d8ed478a9b572aee40.zip
Move source files to src/ directory and add test script to scripts/
Diffstat (limited to '')
-rwxr-xr-xscripts/test.sh12
-rwxr-xr-xsrc/tmux.sh (renamed from scripts/tmux.sh)2
-rwxr-xr-xsrc/toggle-term.sh (renamed from scripts/toggle-term.sh)6
3 files changed, 18 insertions, 2 deletions
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100755
index 0000000..e123124
--- /dev/null
+++ b/scripts/test.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -o errexit
+set -o nounset
+
+DIR=$(dirname "$0")
+ROOT_DIR="$DIR/../"
+
+main() {
+ "$ROOT_DIR/vendor/bats/bin/bats" "$ROOT_DIR/tests/tests.sh"
+}
+
+main "$@"
diff --git a/scripts/tmux.sh b/src/tmux.sh
index b919043..2be86de 100755
--- a/scripts/tmux.sh
+++ b/src/tmux.sh
@@ -1,4 +1,6 @@
#!/bin/sh
+set -o errexit
+set -o nounset
get_tmux_cmd() {
TMUX_CMD="tmux"
diff --git a/scripts/toggle-term.sh b/src/toggle-term.sh
index 0cc7414..3554ec0 100755
--- a/scripts/toggle-term.sh
+++ b/src/toggle-term.sh
@@ -1,4 +1,7 @@
#!/bin/sh
+set -o errexit
+set -o nounset
+
CURRENT_DIR="$(dirname "$0")"
. "$CURRENT_DIR/tmux.sh"
@@ -70,8 +73,7 @@ toggle_split() {
# and toggled it, so it is closed, and now we want to open it again.
# In this case, our single main zoomed in window would be what is on
# the screen and we want to open back up our split pane.
- zoomed_panes="$(echo "${panes_list}" | grep Z)"
- if [ -n "${zoomed_panes}" ]; then
+ if echo "${panes_list}" | grep -q Z; then
# To open back up our split pane, we can switch focus to the previously
# active pane in the current window of the current session.
#