mirror of
https://github.com/skoelle/kctl-tui.git
synced 2026-09-17 20:10:24 +00:00
Compare commits
6
Commits
v0.3.4
...
d05d35bdc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d05d35bdc1 | ||
|
|
f8679adf95 | ||
|
|
73cc510347 | ||
|
|
d17eb6971c | ||
|
|
fb4c1be12b | ||
|
|
9e3fefb71a |
@@ -355,7 +355,7 @@ func (m *fullModel) startWtSession() tea.Cmd {
|
||||
kubeexec.VerboseLog("[debug] panelCmd=%s\n", panelCmd)
|
||||
kubeexec.VerboseLog("[debug] k9sCmdA=%s\n", k9sCmdA)
|
||||
|
||||
wtCmd := fmt.Sprintf("wt new-tab %s ; split-pane -H -s 0.75 %s", panelCmd, k9sCmdA)
|
||||
wtCmd := fmt.Sprintf("wt -M new-tab %s ; split-pane -H -s 0.75 %s", panelCmd, k9sCmdA)
|
||||
|
||||
if len(m.cfg.Envs) > 1 {
|
||||
envB := m.cfg.Envs[1]
|
||||
|
||||
+18
-2
@@ -8,6 +8,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -61,6 +62,11 @@ type panelModel struct {
|
||||
err error
|
||||
}
|
||||
|
||||
// isWtMode returns true when running on Windows with multiplexer: "wt".
|
||||
func (m *panelModel) isWtMode() bool {
|
||||
return runtime.GOOS == "windows" && m.cfg.MultiplexerBackend() == "wt"
|
||||
}
|
||||
|
||||
func runPanel(args []string) error {
|
||||
fs := flag.NewFlagSet("panel", flag.ContinueOnError)
|
||||
context := fs.String("context", "", "context (e.g. internal/external)")
|
||||
@@ -88,6 +94,10 @@ func newPanelModel(context, ns, team string) *panelModel {
|
||||
l.SetFilteringEnabled(false)
|
||||
|
||||
m := &panelModel{context: context, ns: ns, team: team, cfg: cfg, step: stepEnvMenu, list: l, input: ti}
|
||||
if m.isWtMode() {
|
||||
l.DisableQuitKeybindings()
|
||||
l.SetShowHelp(false)
|
||||
}
|
||||
if loadErr != nil {
|
||||
m.err = fmt.Errorf("config load failed: %w", loadErr)
|
||||
m.step = stepError
|
||||
@@ -99,7 +109,9 @@ func newPanelModel(context, ns, team string) *panelModel {
|
||||
|
||||
func (m *panelModel) showEnvMenu() {
|
||||
items := make([]list.Item, 0, len(m.cfg.Envs)+1)
|
||||
items = append(items, simpleItem{label: "Quit (closes this tmux session)", value: "quit"})
|
||||
if !m.isWtMode() {
|
||||
items = append(items, simpleItem{label: "Quit (closes this tmux session)", value: "quit"})
|
||||
}
|
||||
for _, env := range m.cfg.Envs {
|
||||
items = append(items, simpleItem{label: env, value: env})
|
||||
}
|
||||
@@ -179,10 +191,14 @@ func (m *panelModel) usesTextInput() bool {
|
||||
// handleEsc navigates one level up: action menu -> env menu, most
|
||||
// sub-steps -> action menu. From the top-level env menu it closes the
|
||||
// whole tmux session (all panes, including the two k9s status panes)
|
||||
// before quitting this program, per SPEC.md 3.6.
|
||||
// before quitting this program, per SPEC.md 3.6. In wt mode, Esc on
|
||||
// the env menu does nothing — the user closes the wt window manually.
|
||||
func (m *panelModel) handleEsc() (tea.Model, tea.Cmd) {
|
||||
switch m.step {
|
||||
case stepEnvMenu:
|
||||
if m.isWtMode() {
|
||||
return m, nil
|
||||
}
|
||||
exec.Command("tmux", "kill-session", "-t", "kctl").Run()
|
||||
return m, tea.Quit
|
||||
case stepActionMenu:
|
||||
|
||||
Reference in New Issue
Block a user