mirror of
https://github.com/skoelle/kctl-tui.git
synced 2026-09-17 20:10:24 +00:00
Add internal/kubeexec wrapper and cmd/kctl-tui entrypoint (main, full mode)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
@@ -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 }
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user