mirror of
https://github.com/skoelle/kctl-tui.git
synced 2026-09-17 20:10:24 +00:00
Fix Windows: remove -- separator (psmux incompatible), add unknown command error
- Remove -- separator from tmux args (psmux on Windows doesn't support it) - Unknown subcommands now show error + usage (exit 1) instead of starting TUI - --help now always shows usage and exits (no fallthrough to TUI)
This commit is contained in:
@@ -92,10 +92,10 @@ Example startup command (generic placeholders):
|
|||||||
# Kill stale session first (separate command — tmux aborts on kill-session error).
|
# Kill stale session first (separate command — tmux aborts on kill-session error).
|
||||||
tmux kill-session -t kctl
|
tmux kill-session -t kctl
|
||||||
tmux new-session -d -s kctl \
|
tmux new-session -d -s kctl \
|
||||||
-- "kctl-tui panel --context=$CTX_A --ns=$NS --team=$TEAM" \; \
|
"kctl-tui panel --context=$CTX_A --ns=$NS --team=$TEAM" \; \
|
||||||
set-option -t kctl remain-on-exit on \; \
|
set-option -t kctl remain-on-exit on \; \
|
||||||
split-window -v -t kctl:0.0 -- "k9s --context $CTX_A -n $NS" \; \
|
split-window -v -t kctl:0.0 "k9s --context $CTX_A -n $NS" \; \
|
||||||
split-window -v -t kctl:0.1 -- "k9s --context $CTX_B -n $NS" \; \
|
split-window -v -t kctl:0.1 "k9s --context $CTX_B -n $NS" \; \
|
||||||
select-layout -t kctl even-vertical \; \
|
select-layout -t kctl even-vertical \; \
|
||||||
select-pane -t kctl:0.0 \; \
|
select-pane -t kctl:0.0 \; \
|
||||||
attach -t kctl
|
attach -t kctl
|
||||||
|
|||||||
@@ -282,16 +282,16 @@ func (m *fullModel) startTmuxSession() tea.Cmd {
|
|||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"new-session", "-d", "-s", "kctl",
|
"new-session", "-d", "-s", "kctl",
|
||||||
"--", panelCmd, ";",
|
panelCmd, ";",
|
||||||
"set-option", "-t", "kctl", "remain-on-exit", "on", ";",
|
"set-option", "-t", "kctl", "remain-on-exit", "on", ";",
|
||||||
"split-window", "-v", "-t", "kctl:0.0", "--", k9sCmdA, ";",
|
"split-window", "-v", "-t", "kctl:0.0", k9sCmdA, ";",
|
||||||
}
|
}
|
||||||
if len(m.cfg.Envs) > 1 {
|
if len(m.cfg.Envs) > 1 {
|
||||||
envB := m.cfg.Envs[1]
|
envB := m.cfg.Envs[1]
|
||||||
ctxB := m.cfg.ResolveContext(envB, m.selectedContext)
|
ctxB := m.cfg.ResolveContext(envB, m.selectedContext)
|
||||||
k9sCmdB := fmt.Sprintf("k9s --context %s -n %s", ctxB, m.selectedNamespace)
|
k9sCmdB := fmt.Sprintf("k9s --context %s -n %s", ctxB, m.selectedNamespace)
|
||||||
args = append(args,
|
args = append(args,
|
||||||
"split-window", "-v", "-t", "kctl:0.1", "--", k9sCmdB, ";",
|
"split-window", "-v", "-t", "kctl:0.1", k9sCmdB, ";",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
args = append(args,
|
args = append(args,
|
||||||
|
|||||||
@@ -39,10 +39,8 @@ func main() {
|
|||||||
|
|
||||||
if showHelp || len(filtered) == 0 {
|
if showHelp || len(filtered) == 0 {
|
||||||
printUsage()
|
printUsage()
|
||||||
if showHelp && len(filtered) == 0 {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if len(filtered) > 0 {
|
if len(filtered) > 0 {
|
||||||
switch filtered[0] {
|
switch filtered[0] {
|
||||||
@@ -64,6 +62,10 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
default:
|
||||||
|
fmt.Fprintf(os.Stderr, "unknown command: %s\n\n", filtered[0])
|
||||||
|
printUsage()
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user