Add internal/kubeexec wrapper and cmd/kctl-tui entrypoint (main, full mode)

This commit is contained in:
Stefan Koelle
2026-08-09 11:22:15 +02:00
parent dc8bcc555f
commit 96ec9d2e1a
4 changed files with 199 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
package main
import "github.com/skoelle/kctl-tui/internal/kctl"
func distinctLabelValues(namespaces map[string]map[string]string, labelKey string) []string {
return kctl.DistinctLabelValues(namespaces, labelKey)
}
func namespacesForLabelValue(namespaces map[string]map[string]string, labelKey, value string) []string {
return kctl.NamespacesForLabelValue(namespaces, labelKey, value)
}
func findNextContext(current string, pairs []kctl.ContextPair) (string, bool) {
return kctl.FindNextContext(current, pairs)
}
+12
View File
@@ -0,0 +1,12 @@
package main
// simpleItem is a minimal implementation of list.Item used for all
// selection screens (contexts, teams, namespaces, menu actions).
type simpleItem struct {
label string // what is shown to the user
value string // the underlying value (context name, team value, ...)
}
func (i simpleItem) Title() string { return i.label }
func (i simpleItem) Description() string { return "" }
func (i simpleItem) FilterValue() string { return i.label }
+25
View File
@@ -0,0 +1,25 @@
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "panel" {
if err := runPanel(os.Args[2:]); err != nil {
fmt.Fprintln(os.Stderr, "kctl-tui panel error:", err)
os.Exit(1)
}
return
}
m := newFullModel()
p := tea.NewProgram(m, tea.WithAltScreen())
if _, err := p.Run(); err != nil {
fmt.Fprintln(os.Stderr, "kctl-tui error:", err)
os.Exit(1)
}
}