Fernand Galiana 2024-01-18 12:33:10 -07:00 committed by GitHub
parent ecb253622e
commit c76703a6e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View File

@ -67,6 +67,12 @@ var stdGroups = []string{
"v1",
}
func (m ResourceMetas) clear() {
for k := range m {
delete(m, k)
}
}
// Meta represents available resource metas.
type Meta struct {
resMetas ResourceMetas
@ -188,7 +194,7 @@ func (m *Meta) LoadResources(f Factory) error {
m.mx.Lock()
defer m.mx.Unlock()
m.resMetas = make(ResourceMetas, 100)
m.resMetas.clear()
if err := loadPreferred(f, m.resMetas); err != nil {
return err
}

View File

@ -469,9 +469,6 @@ func (a *App) switchContext(ci *cmd.Interpreter, force bool) error {
if err != nil {
return err
}
if err := a.command.Reset(a.Config.ContextAliasesPath(), true); err != nil {
return err
}
if cns, ok := ci.NSArg(); ok {
ct.Namespace.Active = cns
}
@ -493,6 +490,9 @@ func (a *App) switchContext(ci *cmd.Interpreter, force bool) error {
log.Error().Err(err).Msg("config save failed!")
}
a.initFactory(ns)
if err := a.command.Reset(a.Config.ContextAliasesPath(), true); err != nil {
return err
}
log.Debug().Msgf("--> Switching Context %q -- %q -- %q", name, ns, a.Config.ActiveView())
a.Flash().Infof("Switching context to %q::%q", name, ns)

View File

@ -41,7 +41,7 @@ func NewCommand(app *App) *Command {
func (c *Command) Init(path string) error {
c.alias = dao.NewAlias(c.app.factory)
if _, err := c.alias.Ensure(path); err != nil {
log.Error().Err(err).Msgf("command init failed!")
log.Error().Err(err).Msgf("Alias ensure failed!")
return err
}
customViewers = loadCustomViewers()