updates
parent
2b34270aa2
commit
cfb38b1587
|
|
@ -45,10 +45,10 @@ func init() {
|
|||
|
||||
// Klogs (of course) want to print stuff to the screen ;(
|
||||
klog.InitFlags(nil)
|
||||
if err := flag.Set("log_file", config.K9sLogs); err != nil {
|
||||
if err := flag.Set("log_file", "/dev/null"); err != nil {
|
||||
log.Error().Err(err)
|
||||
}
|
||||
if err := flag.Set("stderrthreshold", "error"); err != nil {
|
||||
if err := flag.Set("stderrthreshold", "fatal"); err != nil {
|
||||
log.Error().Err(err)
|
||||
}
|
||||
if err := flag.Set("alsologtostderr", falseFlag); err != nil {
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ func loadK9s(m ResourceMetas) {
|
|||
Name: "aliases",
|
||||
Kind: "Aliases",
|
||||
SingularName: "alias",
|
||||
Verbs: []string{},
|
||||
Categories: []string{"k9s"},
|
||||
}
|
||||
m[client.NewGVR("contexts")] = metav1.APIResource{
|
||||
|
|
@ -130,6 +131,7 @@ func loadK9s(m ResourceMetas) {
|
|||
Kind: "Contexts",
|
||||
SingularName: "context",
|
||||
ShortNames: []string{"ctx"},
|
||||
Verbs: []string{},
|
||||
Categories: []string{"k9s"},
|
||||
}
|
||||
m[client.NewGVR("screendumps")] = metav1.APIResource{
|
||||
|
|
|
|||
|
|
@ -98,6 +98,17 @@ func (t *Table) SendKey(evt *tcell.EventKey) {
|
|||
t.keyboard(evt)
|
||||
}
|
||||
|
||||
func (t *Table) filterInput(r rune) {
|
||||
if !t.cmdBuff.IsActive() {
|
||||
return
|
||||
}
|
||||
t.cmdBuff.Add(r)
|
||||
t.ClearSelection()
|
||||
t.doUpdate(t.filtered(t.GetModel().Peek()))
|
||||
t.UpdateTitle()
|
||||
t.SelectFirstRow()
|
||||
}
|
||||
|
||||
func (t *Table) keyboard(evt *tcell.EventKey) *tcell.EventKey {
|
||||
key := evt.Key()
|
||||
if key == tcell.KeyUp || key == tcell.KeyDown {
|
||||
|
|
@ -105,14 +116,7 @@ func (t *Table) keyboard(evt *tcell.EventKey) *tcell.EventKey {
|
|||
}
|
||||
|
||||
if key == tcell.KeyRune {
|
||||
if t.SearchBuff().IsActive() {
|
||||
t.SearchBuff().Add(evt.Rune())
|
||||
t.ClearSelection()
|
||||
t.doUpdate(t.filtered(t.GetModel().Peek()))
|
||||
t.UpdateTitle()
|
||||
t.SelectFirstRow()
|
||||
return nil
|
||||
}
|
||||
t.filterInput(evt.Rune())
|
||||
key = asKey(evt)
|
||||
}
|
||||
|
||||
|
|
@ -365,7 +369,7 @@ func (t *Table) styleTitle() string {
|
|||
}
|
||||
}
|
||||
|
||||
buff := t.SearchBuff().String()
|
||||
buff := t.cmdBuff.String()
|
||||
var title string
|
||||
if ns == client.ClusterScope {
|
||||
title = SkinTitle(fmt.Sprintf(TitleFmt, base, rc), t.styles.Frame())
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/derailed/k9s/internal/render"
|
||||
"github.com/derailed/k9s/internal/ui"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
const aliasTitle = "Aliases"
|
||||
|
|
@ -48,7 +47,6 @@ func (a *Alias) bindKeys(aa ui.KeyActions) {
|
|||
}
|
||||
|
||||
func (a *Alias) gotoCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||
log.Debug().Msgf("GOTO CMD")
|
||||
r, _ := a.GetTable().GetSelection()
|
||||
if r != 0 {
|
||||
s := ui.TrimCell(a.GetTable().SelectTable, r, 1)
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ func (a *App) refreshCluster() {
|
|||
|
||||
// Reload alias
|
||||
go func() {
|
||||
if err := a.command.Reset(); err != nil {
|
||||
if err := a.command.Reset(false); err != nil {
|
||||
log.Error().Err(err).Msgf("Command reset failed")
|
||||
}
|
||||
}()
|
||||
|
|
@ -256,7 +256,7 @@ func (a *App) switchCtx(name string, loadPods bool) error {
|
|||
}
|
||||
a.initFactory(ns)
|
||||
|
||||
if err := a.command.Reset(); err != nil {
|
||||
if err := a.command.Reset(true); err != nil {
|
||||
return err
|
||||
}
|
||||
a.Config.Reset()
|
||||
|
|
|
|||
|
|
@ -46,11 +46,13 @@ func (c *Command) Init() error {
|
|||
}
|
||||
|
||||
// Reset resets Command and reload aliases.
|
||||
func (c *Command) Reset() error {
|
||||
func (c *Command) Reset(clear bool) error {
|
||||
c.mx.Lock()
|
||||
defer c.mx.Unlock()
|
||||
|
||||
c.alias.Clear()
|
||||
if clear {
|
||||
c.alias.Clear()
|
||||
}
|
||||
if _, err := c.alias.Ensure(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,9 +191,7 @@ func (t *Table) eraseCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
}
|
||||
|
||||
func (t *Table) activateCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||
log.Debug().Msgf("Table filter activated!")
|
||||
if t.app.InCmdMode() {
|
||||
log.Debug().Msgf("App Is in Command mode!")
|
||||
return evt
|
||||
}
|
||||
t.app.Flash().Info("Filter mode activated.")
|
||||
|
|
|
|||
Loading…
Reference in New Issue