cleaning up

mine
derailed 2020-03-23 18:09:44 -06:00
parent 5bdac583ba
commit 94d26a6b3a
9 changed files with 18 additions and 29 deletions

View File

@ -23,14 +23,16 @@ Thank you for your gesture of kindness and for supporting K9s!!
If you've contributed $25 or more please reach out to me on slack with your earth coordinates so I can send you your K9s swags!
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/shirts/k9s_front.png" align="right" width="200" height="auto"/>
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/shirts/k9s_back.png" align="right" width="200" height="auto"/>
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/shirts/k9s_front.png" align="center" width="auto" height="100"/>
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/shirts/k9s_back.png" align="center" width="auto" height="100"/>
NOTE: I am one not to pressure folks into giving. However, it does make me sad to see postings out there with clear indications that K9s is being used and yet zero mentions of the web site nor this repo. K9s marketing budget relies entirely on word of mouth and is not pimped out by big corps. So if you publish your work and leverage K9s, please give us a shoutout or at the very least reference this repo or website!
---
## AutoSuggestions
K9s command mode now provides for autocomplete. Suggestions are pulled from available kubernetes resources and custom aliases. The command mode supports the following commands:
K9s command mode now provides for auto complete. Suggestions are pulled from available kubernetes resources and custom aliases. The command mode supports the following keyboard triggers:
| Key | Description |
|---------------------|------------------------------------------|

View File

@ -267,9 +267,9 @@ var expectedConfig = `k9s:
tail: 500
buffer: 800
sinceSeconds: 300
fullScreenLogs: false
currentContext: blee
currentCluster: blee
fullScreenLogs: false
clusters:
blee:
namespace:
@ -315,11 +315,11 @@ var resetConfig = `k9s:
readOnly: false
logger:
tail: 200
buffer: 1000
buffer: 2000
sinceSeconds: 300
fullScreenLogs: false
currentContext: blee
currentCluster: blee
fullScreenLogs: false
clusters:
blee:
namespace:

View File

@ -15,7 +15,6 @@ type K9s struct {
Logger *Logger `yaml:"logger"`
CurrentContext string `yaml:"currentContext"`
CurrentCluster string `yaml:"currentCluster"`
FullScreenLogs bool `yaml:"fullScreenLogs"`
Clusters map[string]*Cluster `yaml:"clusters,omitempty"`
Thresholds Threshold `yaml:"thresholds"`
manualRefreshRate int

View File

@ -23,7 +23,7 @@ func TestK9sValidate(t *testing.T) {
assert.Equal(t, 2, c.RefreshRate)
assert.Equal(t, int64(100), c.Logger.TailCount)
assert.Equal(t, 1_000, c.Logger.BufferSize)
assert.Equal(t, 5_000, c.Logger.BufferSize)
assert.Equal(t, "ctx1", c.CurrentContext)
assert.Equal(t, "c1", c.CurrentCluster)
assert.Equal(t, 1, len(c.Clusters))
@ -46,7 +46,7 @@ func TestK9sValidateBlank(t *testing.T) {
assert.Equal(t, 2, c.RefreshRate)
assert.Equal(t, int64(100), c.Logger.TailCount)
assert.Equal(t, 1_000, c.Logger.BufferSize)
assert.Equal(t, 5_000, c.Logger.BufferSize)
assert.Equal(t, "ctx1", c.CurrentContext)
assert.Equal(t, "c1", c.CurrentCluster)
assert.Equal(t, 1, len(c.Clusters))

View File

@ -18,6 +18,7 @@ type Logger struct {
TailCount int64 `yaml:"tail"`
BufferSize int `yaml:"buffer"`
SinceSeconds int64 `yaml:"sinceSeconds"`
FullScreenLogs bool `yaml:"fullScreenLogs"`
}
// NewLogger returns a new instance.

View File

@ -12,7 +12,7 @@ func TestNewLogger(t *testing.T) {
l.Validate(nil, nil)
assert.Equal(t, int64(100), l.TailCount)
assert.Equal(t, 1_000, l.BufferSize)
assert.Equal(t, 5_000, l.BufferSize)
}
func TestLoggerValidate(t *testing.T) {
@ -20,5 +20,5 @@ func TestLoggerValidate(t *testing.T) {
l.Validate(nil, nil)
assert.Equal(t, int64(100), l.TailCount)
assert.Equal(t, 1_000, l.BufferSize)
assert.Equal(t, 5_000, l.BufferSize)
}

View File

@ -181,7 +181,6 @@ func (l *Log) bindKeys() {
ui.Key4: ui.NewKeyAction("30m", l.sinceCmd(30*60), true),
ui.Key5: ui.NewKeyAction("1h", l.sinceCmd(60*60), true),
tcell.KeyEnter: ui.NewSharedKeyAction("Filter", l.filterCmd, false),
ui.KeyA: ui.NewKeyAction("Apply", l.applyCmd, true),
ui.KeyC: ui.NewKeyAction("Clear", l.clearCmd, true),
ui.KeyS: ui.NewKeyAction("Toggle AutoScroll", l.toggleAutoScrollCmd, true),
ui.KeyF: ui.NewKeyAction("FullScreen", l.toggleFullScreenCmd, true),
@ -267,18 +266,6 @@ func (l *Log) sinceCmd(a int) func(evt *tcell.EventKey) *tcell.EventKey {
l.updateTitle()
return nil
}
}
func (l *Log) applyCmd(evt *tcell.EventKey) *tcell.EventKey {
if l.app.InCmdMode() {
return evt
}
ShowLogs(l.app, "blee", l.filterLogs)
return nil
}
func (l *Log) filterLogs(path string, opts dao.LogOptions) {
}
func (l *Log) filterCmd(evt *tcell.EventKey) *tcell.EventKey {

View File

@ -25,7 +25,7 @@ func NewLogIndicator(cfg *config.Config, styles *config.Styles) *LogIndicator {
styles: styles,
TextView: tview.NewTextView(),
scrollStatus: 1,
fullScreen: cfg.K9s.FullScreenLogs,
fullScreen: cfg.K9s.Logger.FullScreenLogs,
}
l.StylesChanged(styles)
styles.AddListener(&l)

View File

@ -16,7 +16,7 @@ func TestLogAutoScroll(t *testing.T) {
v.GetModel().Set(dao.LogItems{dao.NewLogItemFromString("blee"), dao.NewLogItemFromString("bozo")})
v.GetModel().Notify(true)
assert.Equal(t, 14, len(v.Hints()))
assert.Equal(t, 13, len(v.Hints()))
v.toggleAutoScrollCmd(nil)
assert.Equal(t, "Autoscroll: Off FullScreen: Off Timestamps: Off Wrap: Off ", v.Indicator().GetText(true))