Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kubectl-switch for openSUSE:Factory checked in at 2025-12-16 15:56:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kubectl-switch (Old) and /work/SRC/openSUSE:Factory/.kubectl-switch.new.1939 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kubectl-switch" Tue Dec 16 15:56:55 2025 rev:14 rq:1323053 version:2.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kubectl-switch/kubectl-switch.changes 2025-12-15 12:06:25.043568969 +0100 +++ /work/SRC/openSUSE:Factory/.kubectl-switch.new.1939/kubectl-switch.changes 2025-12-16 16:02:55.431710724 +0100 @@ -1,0 +2,16 @@ +Tue Dec 16 05:51:55 UTC 2025 - Johannes Kastl <[email protected]> + +- Update to version 2.4.0: + * New Features + - add page size config option (#218) (27abf02) + * Bug Fixes + - load namespaces and contexts only when needed (a9a7555) + - replace survey with bubbletea (#219) (3678057) + * CI/CD + - update/cleanup triggers (5411847) + - github-action: update renovatebot/github-action ( v44.0.5 → + v44.1.0 ) (df9372b) + - github-action: update github/codeql-action ( v4.31.7 → + v4.31.8 ) (5249fe7) + +------------------------------------------------------------------- Old: ---- kubectl-switch-2.3.5.obscpio New: ---- kubectl-switch-2.4.0.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kubectl-switch.spec ++++++ --- /var/tmp/diff_new_pack.P4RQmv/_old 2025-12-16 16:02:59.799895301 +0100 +++ /var/tmp/diff_new_pack.P4RQmv/_new 2025-12-16 16:02:59.799895301 +0100 @@ -17,7 +17,7 @@ Name: kubectl-switch -Version: 2.3.5 +Version: 2.4.0 Release: 0 Summary: Simple tool to help manage multiple kubeconfig files License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.P4RQmv/_old 2025-12-16 16:02:59.839896991 +0100 +++ /var/tmp/diff_new_pack.P4RQmv/_new 2025-12-16 16:02:59.843897160 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/mirceanton/kubectl-switch</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v2.3.5</param> + <param name="revision">v2.4.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.P4RQmv/_old 2025-12-16 16:02:59.871898343 +0100 +++ /var/tmp/diff_new_pack.P4RQmv/_new 2025-12-16 16:02:59.875898512 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/mirceanton/kubectl-switch</param> - <param name="changesrevision">97ac2eba880ad0c4c244d20c33305134b1f78bb0</param></service></servicedata> + <param name="changesrevision">541184747373d111393aed5774336a11b724e7a6</param></service></servicedata> (No newline at EOF) ++++++ kubectl-switch-2.3.5.obscpio -> kubectl-switch-2.4.0.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/cmd/context.go new/kubectl-switch-2.4.0/cmd/context.go --- old/kubectl-switch-2.3.5/cmd/context.go 2025-12-13 04:26:18.000000000 +0100 +++ new/kubectl-switch-2.4.0/cmd/context.go 2025-12-15 23:03:44.000000000 +0100 @@ -1,7 +1,7 @@ package cmd import ( - "github.com/AlecAivazis/survey/v2" + "github.com/mirceanton/kubectl-switch/v2/internal/ui" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -13,6 +13,10 @@ ValidArgsFunction: getContextCompletions, Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { + if err := configManager.LoadContexts(); err != nil { + log.Fatalf("Failed to load contexts: %v", err) + } + contextNames := configManager.GetAllContexts() if len(contextNames) == 0 { log.Fatal("No kubernetes contexts found in the provided directory") @@ -22,13 +26,12 @@ if len(args) == 1 { selectedContext = args[0] } else { - prompt := &survey.Select{ - Message: "Choose a context:", - Options: contextNames, - } - if err := survey.AskOne(prompt, &selectedContext); err != nil { + currentContext := configManager.GetCurrentContext() + selected, err := ui.Select("Choose a context:", contextNames, currentContext, appConfig.PageSize) + if err != nil { log.Fatalf("Failed to get user input: %v", err) } + selectedContext = selected } if err := configManager.SwitchToContext(selectedContext); err != nil { @@ -44,5 +47,8 @@ } func getContextCompletions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + if err := configManager.LoadContexts(); err != nil { + return nil, cobra.ShellCompDirectiveError + } return configManager.GetAllContexts(), cobra.ShellCompDirectiveNoFileComp } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/cmd/namespace.go new/kubectl-switch-2.4.0/cmd/namespace.go --- old/kubectl-switch-2.3.5/cmd/namespace.go 2025-12-13 04:26:18.000000000 +0100 +++ new/kubectl-switch-2.4.0/cmd/namespace.go 2025-12-15 23:03:44.000000000 +0100 @@ -1,7 +1,7 @@ package cmd import ( - "github.com/AlecAivazis/survey/v2" + "github.com/mirceanton/kubectl-switch/v2/internal/ui" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -13,6 +13,10 @@ Args: cobra.MaximumNArgs(1), ValidArgsFunction: getNamespaceCompletions, Run: func(cmd *cobra.Command, args []string) { + if err := configManager.LoadNamespaces(); err != nil { + log.Fatalf("Failed to load namespaces: %v", err) + } + namespaceNames := configManager.GetAllNamespaces() if len(namespaceNames) == 0 { log.Fatal("No kubernetes namespaces found in the current cluster") @@ -22,13 +26,12 @@ if len(args) == 1 { selectedNamespace = args[0] } else { - prompt := &survey.Select{ - Message: "Choose a namespace:", - Options: namespaceNames, - } - if err := survey.AskOne(prompt, &selectedNamespace); err != nil { + currentNamespace := configManager.GetCurrentNamespace() + selected, err := ui.Select("Choose a namespace:", namespaceNames, currentNamespace, appConfig.PageSize) + if err != nil { log.Fatalf("Failed to get user input: %v", err) } + selectedNamespace = selected } if err := configManager.SwitchToNamespace(selectedNamespace); err != nil { @@ -44,5 +47,8 @@ } func getNamespaceCompletions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + if err := configManager.LoadNamespaces(); err != nil { + return nil, cobra.ShellCompDirectiveError + } return configManager.GetAllNamespaces(), cobra.ShellCompDirectiveNoFileComp } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/cmd/root.go new/kubectl-switch-2.4.0/cmd/root.go --- old/kubectl-switch-2.3.5/cmd/root.go 2025-12-13 04:26:18.000000000 +0100 +++ new/kubectl-switch-2.4.0/cmd/root.go 2025-12-15 23:03:44.000000000 +0100 @@ -13,6 +13,7 @@ var ( version string configManager *manager.Manager + appConfig *config.Config ) var rootCmd = &cobra.Command{ @@ -25,17 +26,18 @@ Version: version, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { // Load configuration - cfg, err := config.Load() + var err error + appConfig, err = config.Load() if err != nil { return err } // Set up logging - log.SetLevel(cfg.LogLevel) - log.SetFormatter(cfg.LogFormat) + log.SetLevel(appConfig.LogLevel) + log.SetFormatter(appConfig.LogFormat) // Create manager with config - configManager, err = manager.NewManager(cfg.Kubeconfig, cfg.KubeconfigDir) + configManager, err = manager.NewManager(appConfig.Kubeconfig, appConfig.KubeconfigDir) if err != nil { return err } @@ -86,4 +88,10 @@ if err != nil { log.Fatalf("Failed to bind flag: %v", err) } + + rootCmd.PersistentFlags().Int("page-size", 10, "Number of items to show per page in selection prompts (env: PAGE_SIZE)") + err = viper.BindPFlag("page-size", rootCmd.PersistentFlags().Lookup("page-size")) + if err != nil { + log.Fatalf("Failed to bind flag: %v", err) + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/go.mod new/kubectl-switch-2.4.0/go.mod --- old/kubectl-switch-2.3.5/go.mod 2025-12-13 04:26:18.000000000 +0100 +++ new/kubectl-switch-2.4.0/go.mod 2025-12-15 23:03:44.000000000 +0100 @@ -6,7 +6,9 @@ retract [v2.0.0, v2.2.5] require ( - github.com/AlecAivazis/survey/v2 v2.3.7 + github.com/charmbracelet/bubbles v0.21.0 + github.com/charmbracelet/bubbletea v1.3.10 + github.com/charmbracelet/lipgloss v1.1.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.10.2 github.com/spf13/viper v1.21.0 @@ -15,8 +17,14 @@ ) require ( + github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect + github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect + github.com/charmbracelet/x/ansi v0.10.1 // indirect + github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect + github.com/charmbracelet/x/term v0.2.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/go-logr/logr v1.4.2 // indirect @@ -30,16 +38,20 @@ github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect + github.com/mattn/go-localereader v0.0.1 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect + github.com/muesli/cancelreader v0.2.2 // indirect + github.com/muesli/termenv v0.16.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/spf13/afero v1.15.0 // indirect @@ -47,11 +59,12 @@ github.com/spf13/pflag v1.0.10 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/x448/float16 v0.8.4 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.38.0 // indirect golang.org/x/oauth2 v0.27.0 // indirect - golang.org/x/sys v0.31.0 // indirect + golang.org/x/sys v0.36.0 // indirect golang.org/x/term v0.30.0 // indirect golang.org/x/text v0.28.0 // indirect golang.org/x/time v0.9.0 // indirect diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/go.sum new/kubectl-switch-2.4.0/go.sum --- old/kubectl-switch-2.3.5/go.sum 2025-12-13 04:26:18.000000000 +0100 +++ new/kubectl-switch-2.4.0/go.sum 2025-12-15 23:03:44.000000000 +0100 @@ -1,17 +1,29 @@ -github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= -github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= -github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= -github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= +github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= +github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs= +github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg= +github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= +github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4= +github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= +github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= +github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= +github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= +github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ= +github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE= +github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8= +github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= +github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= +github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= -github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= +github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= @@ -43,16 +55,12 @@ github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= -github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -62,24 +70,28 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= -github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= +github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= +github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= +github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= +github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= +github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM= @@ -92,6 +104,9 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -105,8 +120,6 @@ github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= -github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= -github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -120,7 +133,6 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -131,9 +143,10 @@ github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= @@ -141,16 +154,14 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E= +golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= @@ -158,28 +169,18 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= @@ -188,7 +189,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -207,22 +207,10 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM= -k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk= -k8s.io/api v0.34.2 h1:fsSUNZhV+bnL6Aqrp6O7lMTy6o5x2C4XLjnh//8SLYY= -k8s.io/api v0.34.2/go.mod h1:MMBPaWlED2a8w4RSeanD76f7opUoypY8TFYkSM+3XHw= k8s.io/api v0.34.3 h1:D12sTP257/jSH2vHV2EDYrb16bS7ULlHpdNdNhEw2S4= k8s.io/api v0.34.3/go.mod h1:PyVQBF886Q5RSQZOim7DybQjAbVs8g7gwJNhGtY5MBk= -k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4= -k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= -k8s.io/apimachinery v0.34.2 h1:zQ12Uk3eMHPxrsbUJgNF8bTauTVR2WgqJsTmwTE/NW4= -k8s.io/apimachinery v0.34.2/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= k8s.io/apimachinery v0.34.3 h1:/TB+SFEiQvN9HPldtlWOTp0hWbJ+fjU+wkxysf/aQnE= k8s.io/apimachinery v0.34.3/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= -k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY= -k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8= -k8s.io/client-go v0.34.2 h1:Co6XiknN+uUZqiddlfAjT68184/37PS4QAzYvQvDR8M= -k8s.io/client-go v0.34.2/go.mod h1:2VYDl1XXJsdcAxw7BenFslRQX28Dxz91U9MWKjX97fE= k8s.io/client-go v0.34.3 h1:wtYtpzy/OPNYf7WyNBTj3iUA0XaBHVqhv4Iv3tbrF5A= k8s.io/client-go v0.34.3/go.mod h1:OxxeYagaP9Kdf78UrKLa3YZixMCfP6bgPwPwNBQBzpM= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/internal/config/config.go new/kubectl-switch-2.4.0/internal/config/config.go --- old/kubectl-switch-2.3.5/internal/config/config.go 2025-12-13 04:26:18.000000000 +0100 +++ new/kubectl-switch-2.4.0/internal/config/config.go 2025-12-15 23:03:44.000000000 +0100 @@ -17,6 +17,7 @@ Kubeconfig string LogLevel log.Level LogFormat log.Formatter + PageSize int } const ( @@ -25,10 +26,12 @@ keyKubeconfig = "kubeconfig" keyLogLevel = "log-level" keyLogFormat = "log-format" + keyPageSize = "page-size" // Default values defaultLogLevel = "info" defaultLogFormat = "text" + defaultPageSize = 10 ) var ( @@ -50,6 +53,7 @@ viper.SetDefault(keyKubeconfig, defaultKubeconfig) viper.SetDefault(keyLogLevel, defaultLogLevel) viper.SetDefault(keyLogFormat, defaultLogFormat) + viper.SetDefault(keyPageSize, defaultPageSize) } // Load returns the current configuration @@ -94,6 +98,9 @@ log.Warn("You can still switch contexts, but namespace operations will not be available") } + // Get page size + cfg.PageSize = viper.GetInt(keyPageSize) + return cfg, nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/internal/manager/manager.go new/kubectl-switch-2.4.0/internal/manager/manager.go --- old/kubectl-switch-2.3.5/internal/manager/manager.go 2025-12-13 04:26:18.000000000 +0100 +++ new/kubectl-switch-2.4.0/internal/manager/manager.go 2025-12-15 23:03:44.000000000 +0100 @@ -23,25 +23,14 @@ } // NewManager creates a new kubeconfig Manager instance. -// It takes the validated configuration paths and loads available contexts. func NewManager(kubeconfigPath, kubeconfigDir string) (*Manager, error) { m := &Manager{ kubeconfigPath: kubeconfigPath, kubeconfigDir: kubeconfigDir, backupPath: kubeconfigPath + ".previous", - } - - // Load available contexts from the config directory - if err := m.loadContexts(); err != nil { - return nil, fmt.Errorf("failed to load contexts: %w", err) - } - - // Load available namespaces from the current cluster - // This may fail if no kubeconfig is active, which is OK - if err := m.loadNamespaces(); err != nil { - log.Warnf("Failed to load namespaces: %v", err) - log.Warn("Namespace operations will not be available until a valid context is selected") - m.namespaceNames = []string{} // Initialize to empty slice + contextMap: make(map[string]string), + contextNames: []string{}, + namespaceNames: []string{}, } return m, nil @@ -57,6 +46,27 @@ return m.namespaceNames } +// GetCurrentContext returns the current context name from the kubeconfig. +func (m *Manager) GetCurrentContext() string { + kubeconfig, err := clientcmd.LoadFromFile(m.kubeconfigPath) + if err != nil { + return "" + } + return kubeconfig.CurrentContext +} + +// GetCurrentNamespace returns the namespace for the current context. +func (m *Manager) GetCurrentNamespace() string { + kubeconfig, err := clientcmd.LoadFromFile(m.kubeconfigPath) + if err != nil { + return "" + } + if ctx, exists := kubeconfig.Contexts[kubeconfig.CurrentContext]; exists { + return ctx.Namespace + } + return "" +} + // SwitchToContext switches to the specified Kubernetes context. func (m *Manager) SwitchToContext(contextName string) error { // Find the kubeconfig file containing the desired context @@ -154,8 +164,8 @@ return nil } -// loadContexts scans the config directory for kubeconfig files and loads all available contexts. -func (m *Manager) loadContexts() error { +// LoadContexts scans the config directory for kubeconfig files and loads all available contexts. +func (m *Manager) LoadContexts() error { m.contextMap = make(map[string]string) m.contextNames = nil @@ -190,8 +200,8 @@ return nil } -// loadNamespaces loads all namespaces from the current Kubernetes cluster. -func (m *Manager) loadNamespaces() error { +// LoadNamespaces loads all namespaces from the current Kubernetes cluster. +func (m *Manager) LoadNamespaces() error { config, err := clientcmd.BuildConfigFromFlags("", m.kubeconfigPath) if err != nil { return fmt.Errorf("failed to build config: %w", err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-switch-2.3.5/internal/ui/select.go new/kubectl-switch-2.4.0/internal/ui/select.go --- old/kubectl-switch-2.3.5/internal/ui/select.go 1970-01-01 01:00:00.000000000 +0100 +++ new/kubectl-switch-2.4.0/internal/ui/select.go 2025-12-15 23:03:44.000000000 +0100 @@ -0,0 +1,369 @@ +package ui + +import ( + "fmt" + "strings" + + "github.com/charmbracelet/bubbles/key" + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/lipgloss" +) + +// SelectModel represents a selection list component +type SelectModel struct { + message string + options []string + filteredOptions []string + filter string + current string + cursor int + pageSize int + offset int + width int + selected string + quitting bool + aborted bool +} + +// Styles for the select component +var ( + cursorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("6")) // cyan + normalStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("250")) // light gray + currentStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("5")) // magenta + + // Prompt styles + promptStyle = lipgloss.NewStyle(). + Foreground(lipgloss.Color("7")). + Background(lipgloss.Color("4")). + Bold(true). + Padding(0, 1) + filterStyle = lipgloss.NewStyle(). + Foreground(lipgloss.Color("3")). + Italic(true) + hintStyle = lipgloss.NewStyle(). + Foreground(lipgloss.Color("8")) +) + +// fuzzyMatch performs a simple fuzzy match - checks if all characters in pattern +// appear in str in order (case-insensitive) +func fuzzyMatch(str, pattern string) bool { + if pattern == "" { + return true + } + str = strings.ToLower(str) + pattern = strings.ToLower(pattern) + + patternIdx := 0 + for i := 0; i < len(str) && patternIdx < len(pattern); i++ { + if str[i] == pattern[patternIdx] { + patternIdx++ + } + } + return patternIdx == len(pattern) +} + +// Key bindings +type keyMap struct { + Up key.Binding + Down key.Binding + Right key.Binding + Enter key.Binding + Quit key.Binding + Escape key.Binding + PgUp key.Binding + PgDown key.Binding + Home key.Binding + End key.Binding +} + +var keys = keyMap{ + Up: key.NewBinding( + key.WithKeys("up"), + key.WithHelp("up", "move up"), + ), + Down: key.NewBinding( + key.WithKeys("down"), + key.WithHelp("down", "move down"), + ), + Right: key.NewBinding( + key.WithKeys("right"), + key.WithHelp("right", "use as filter"), + ), + Enter: key.NewBinding( + key.WithKeys("enter"), + key.WithHelp("enter", "select"), + ), + Quit: key.NewBinding( + key.WithKeys("ctrl+c"), + key.WithHelp("ctrl+c", "quit"), + ), + Escape: key.NewBinding( + key.WithKeys("esc"), + key.WithHelp("esc", "clear filter/quit"), + ), + PgUp: key.NewBinding( + key.WithKeys("pgup"), + key.WithHelp("pgup", "page up"), + ), + PgDown: key.NewBinding( + key.WithKeys("pgdown"), + key.WithHelp("pgdown", "page down"), + ), + Home: key.NewBinding( + key.WithKeys("home"), + key.WithHelp("home", "go to start"), + ), + End: key.NewBinding( + key.WithKeys("end"), + key.WithHelp("end", "go to end"), + ), +} + +// NewSelectModel creates a new selection model +func NewSelectModel(message string, options []string, current string, pageSize int) SelectModel { + if pageSize <= 0 { + pageSize = 10 + } + // Initialize filteredOptions as a copy of options + filteredOptions := make([]string, len(options)) + copy(filteredOptions, options) + + return SelectModel{ + message: message, + options: options, + filteredOptions: filteredOptions, + filter: "", + current: current, + cursor: 0, + pageSize: pageSize, + offset: 0, + width: 80, + } +} + +// Init implements tea.Model +func (m SelectModel) Init() tea.Cmd { + return nil +} + +// Update implements tea.Model +func (m SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + switch msg := msg.(type) { + case tea.WindowSizeMsg: + m.width = msg.Width + case tea.KeyMsg: + switch { + case key.Matches(msg, keys.Quit): + m.aborted = true + m.quitting = true + return m, tea.Quit + + case key.Matches(msg, keys.Escape): + if m.filter != "" { + m.filter = "" + m.updateFilter() + } else { + m.aborted = true + m.quitting = true + return m, tea.Quit + } + + case key.Matches(msg, keys.Enter): + if len(m.filteredOptions) > 0 { + m.selected = m.filteredOptions[m.cursor] + m.quitting = true + return m, tea.Quit + } + + case key.Matches(msg, keys.Right): + if len(m.filteredOptions) > 0 { + m.filter = m.filteredOptions[m.cursor] + m.updateFilter() + } + + case key.Matches(msg, keys.Up): + if len(m.filteredOptions) > 0 { + if m.cursor > 0 { + m.cursor-- + } else { + m.cursor = len(m.filteredOptions) - 1 + } + m.adjustOffset() + } + + case key.Matches(msg, keys.Down): + if len(m.filteredOptions) > 0 { + if m.cursor < len(m.filteredOptions)-1 { + m.cursor++ + } else { + m.cursor = 0 + } + m.adjustOffset() + } + + case key.Matches(msg, keys.PgUp): + m.cursor -= m.pageSize + if m.cursor < 0 { + m.cursor = 0 + } + m.adjustOffset() + + case key.Matches(msg, keys.PgDown): + m.cursor += m.pageSize + if m.cursor >= len(m.filteredOptions) { + m.cursor = len(m.filteredOptions) - 1 + } + if m.cursor < 0 { + m.cursor = 0 + } + m.adjustOffset() + + case key.Matches(msg, keys.Home): + m.cursor = 0 + m.adjustOffset() + + case key.Matches(msg, keys.End): + if len(m.filteredOptions) > 0 { + m.cursor = len(m.filteredOptions) - 1 + } + m.adjustOffset() + + default: + // Handle character input for filtering + keyStr := msg.String() + if keyStr == "backspace" { + if len(m.filter) > 0 { + m.filter = m.filter[:len(m.filter)-1] + m.updateFilter() + } + } else if len(keyStr) == 1 && keyStr[0] >= 32 && keyStr[0] < 127 { + // Printable ASCII character + m.filter += keyStr + m.updateFilter() + } + } + } + + return m, nil +} + +// updateFilter updates the filtered options based on the current filter +func (m *SelectModel) updateFilter() { + m.filteredOptions = nil + for _, opt := range m.options { + if fuzzyMatch(opt, m.filter) { + m.filteredOptions = append(m.filteredOptions, opt) + } + } + // Reset cursor and offset when filter changes + m.cursor = 0 + m.offset = 0 +} + +// adjustOffset ensures the cursor is visible within the page +func (m *SelectModel) adjustOffset() { + if m.cursor < m.offset { + m.offset = m.cursor + } + if m.cursor >= m.offset+m.pageSize { + m.offset = m.cursor - m.pageSize + 1 + } +} + +// View implements tea.Model +func (m SelectModel) View() string { + if m.quitting { + return "" + } + + var b strings.Builder + + // Build left side of header + leftSide := promptStyle.Render(m.message) + " " + if m.filter != "" { + leftSide += filterStyle.Render(m.filter) + } else { + leftSide += hintStyle.Render("Type to filter...") + } + + // Build right side (counter) + rightSide := hintStyle.Render(fmt.Sprintf("(%d/%d)", m.cursor+1, len(m.filteredOptions))) + + // Calculate padding for right alignment + leftLen := lipgloss.Width(leftSide) + rightLen := lipgloss.Width(rightSide) + padding := m.width - leftLen - rightLen + if padding < 1 { + padding = 1 + } + + b.WriteString(leftSide) + b.WriteString(strings.Repeat(" ", padding)) + b.WriteString(rightSide) + b.WriteString("\n") + + // Handle empty filtered results + if len(m.filteredOptions) == 0 { + b.WriteString(normalStyle.Render(" No matches found")) + b.WriteString("\n") + return b.String() + } + + // Calculate visible range + end := m.offset + m.pageSize + if end > len(m.filteredOptions) { + end = len(m.filteredOptions) + } + + // Display options + for i := m.offset; i < end; i++ { + option := m.filteredOptions[i] + isCurrent := option == m.current + + if i == m.cursor { + b.WriteString(cursorStyle.Render("> ")) + b.WriteString(cursorStyle.Render(option)) + } else { + b.WriteString(" ") + if isCurrent { + b.WriteString(currentStyle.Render(option)) + } else { + b.WriteString(normalStyle.Render(option)) + } + } + if isCurrent { + b.WriteString(currentStyle.Render(" (current)")) + } + b.WriteString("\n") + } + + return b.String() +} + +// Selected returns the selected option +func (m SelectModel) Selected() string { + return m.selected +} + +// Aborted returns true if the user aborted the selection +func (m SelectModel) Aborted() bool { + return m.aborted +} + +// Select runs an interactive selection prompt and returns the selected option +func Select(message string, options []string, current string, pageSize int) (string, error) { + model := NewSelectModel(message, options, current, pageSize) + p := tea.NewProgram(model) + + finalModel, err := p.Run() + if err != nil { + return "", fmt.Errorf("failed to run selection: %w", err) + } + + result := finalModel.(SelectModel) + if result.Aborted() { + return "", fmt.Errorf("selection aborted") + } + + return result.Selected(), nil +} ++++++ kubectl-switch.obsinfo ++++++ --- /var/tmp/diff_new_pack.P4RQmv/_old 2025-12-16 16:03:00.031905103 +0100 +++ /var/tmp/diff_new_pack.P4RQmv/_new 2025-12-16 16:03:00.035905273 +0100 @@ -1,5 +1,5 @@ name: kubectl-switch -version: 2.3.5 -mtime: 1765596378 -commit: 97ac2eba880ad0c4c244d20c33305134b1f78bb0 +version: 2.4.0 +mtime: 1765836224 +commit: 541184747373d111393aed5774336a11b724e7a6 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/kubectl-switch/vendor.tar.gz /work/SRC/openSUSE:Factory/.kubectl-switch.new.1939/vendor.tar.gz differ: char 15, line 1
