Skip to content

Commit cd3760c

Browse files
authored
fix: skip tmux -T title flag on versions older than 3.3 (#40)
* fix: skip tmux -T title flag on versions older than 3.3 The -T flag for display-popup was added in tmux 3.3. Detect version and conditionally include it to avoid errors on older tmux installs. Also remove go runtime version from --version output. * fix: use bash regex instead of sort -V for tmux version check sort -V is a GNU extension not available on all platforms. Use bash BASH_REMATCH for portable major/minor comparison.
1 parent 91da2f2 commit cd3760c

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

.claude-plugin/skills/revdiff/scripts/launch-revdiff.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,15 @@ POPUP_H="${REVDIFF_POPUP_HEIGHT:-90%}"
4545

4646
# tmux: display-popup -E blocks until command exits
4747
if [ -n "${TMUX:-}" ] && command -v tmux >/dev/null 2>&1; then
48-
tmux display-popup -E -w "$POPUP_W" -h "$POPUP_H" -T " $OVERLAY_TITLE " -d "$CWD" -- sh -c "$REVDIFF_CMD"
48+
# -T (title) requires tmux 3.3+; skip on older versions
49+
TMUX_ARGS=(tmux display-popup -E -w "$POPUP_W" -h "$POPUP_H")
50+
if [[ "$(tmux -V 2>/dev/null)" =~ ([0-9]+)\.([0-9]+) ]]; then
51+
if [ "${BASH_REMATCH[1]}" -gt 3 ] || { [ "${BASH_REMATCH[1]}" -eq 3 ] && [ "${BASH_REMATCH[2]}" -ge 3 ]; }; then
52+
TMUX_ARGS+=(-T " $OVERLAY_TITLE ")
53+
fi
54+
fi
55+
TMUX_ARGS+=(-d "$CWD" -- sh -c "$REVDIFF_CMD")
56+
"${TMUX_ARGS[@]}"
4957
cat "$OUTPUT_FILE"
5058
exit 0
5159
fi

cmd/revdiff/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"os"
99
"os/exec"
1010
"path/filepath"
11-
"runtime"
1211
"strings"
1312

1413
tea "github.com/charmbracelet/bubbletea"
@@ -103,7 +102,7 @@ func main() {
103102

104103
// early-exit commands that don't need theme resolution
105104
if opts.Version {
106-
fmt.Printf("version: %s\ngo: %s\n", revision, runtime.Version())
105+
fmt.Printf("version: %s\n", revision)
107106
os.Exit(0)
108107
}
109108

plugins/revdiff-planning/scripts/launch-plan-review.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ OVERLAY_TITLE="plan: $(basename "$PLAN_FILE")"
3535

3636
# tmux: display-popup -E blocks until command exits
3737
if [ -n "${TMUX:-}" ] && command -v tmux >/dev/null 2>&1; then
38-
tmux display-popup -E -w 90% -h 90% -T " $OVERLAY_TITLE " -- sh -c "$REVDIFF_CMD"
38+
# -T (title) requires tmux 3.3+; skip on older versions
39+
TMUX_ARGS=(tmux display-popup -E -w 90% -h 90%)
40+
if [[ "$(tmux -V 2>/dev/null)" =~ ([0-9]+)\.([0-9]+) ]]; then
41+
if [ "${BASH_REMATCH[1]}" -gt 3 ] || { [ "${BASH_REMATCH[1]}" -eq 3 ] && [ "${BASH_REMATCH[2]}" -ge 3 ]; }; then
42+
TMUX_ARGS+=(-T " $OVERLAY_TITLE ")
43+
fi
44+
fi
45+
TMUX_ARGS+=(-- sh -c "$REVDIFF_CMD")
46+
"${TMUX_ARGS[@]}"
3947
cat "$OUTPUT_FILE"
4048
exit 0
4149
fi

0 commit comments

Comments
 (0)