feat(v0.5.3): doctor -- checkTmux three-state helper
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/warrenronsiek/ctask/internal/config"
|
||||
"github.com/warrenronsiek/ctask/internal/shell"
|
||||
"github.com/warrenronsiek/ctask/internal/workspace"
|
||||
)
|
||||
|
||||
@@ -203,6 +204,9 @@ func runDoctor(cmd *cobra.Command, args []string) error {
|
||||
// Check 8: CTASK_PROJECT_ROOT (v0.5).
|
||||
checkProjectRoot(&passed, &failed)
|
||||
|
||||
// Check 9: tmux availability for persistent session mode (v0.5.3).
|
||||
checkTmux(&passed, &failed)
|
||||
|
||||
// Summary
|
||||
fmt.Println()
|
||||
fmt.Printf("%d checks passed, %d failed\n", passed, failed)
|
||||
@@ -254,3 +258,29 @@ func checkSeedDir(label, envValue, resolved, envName string, passed, failed *int
|
||||
fmt.Printf(" Fix: create the directory or unset %s to use built-in defaults.\n", envName)
|
||||
*failed++
|
||||
}
|
||||
|
||||
// checkTmux reports the three-state tmux check (v0.5.3):
|
||||
// - CTASK_SESSION_MODE != "persistent" -> INFO (direct mode, tmux optional)
|
||||
// - persistent + tmux on PATH + version OK -> two INFO lines
|
||||
// - persistent + tmux missing or too old -> FAIL with install/update hint
|
||||
func checkTmux(passed, failed *int) {
|
||||
_ = passed
|
||||
mode := config.ResolveSessionMode()
|
||||
if mode != "persistent" {
|
||||
fmt.Printf(" [INFO] Session mode: direct (tmux not required)\n")
|
||||
return
|
||||
}
|
||||
fmt.Printf(" [INFO] Session mode: persistent\n")
|
||||
tmuxPath, ver, err := shell.LookupTmux()
|
||||
if err != nil {
|
||||
fmt.Printf(" [FAIL] tmux not found on PATH or unsupported version: %v\n", err)
|
||||
fmt.Printf(" Fix: install tmux 3.0+ (apt/brew/pacman/dnf), or unset CTASK_SESSION_MODE\n")
|
||||
*failed++
|
||||
return
|
||||
}
|
||||
rawVer := ver.Raw
|
||||
if rawVer == "" {
|
||||
rawVer = "unknown version"
|
||||
}
|
||||
fmt.Printf(" [INFO] tmux found: %s (%s)\n", rawVer, tmuxPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user