add command prompt

mine
derailed 2020-03-24 17:26:20 -06:00
parent c6a8477e5b
commit 1dfca156bc
8 changed files with 54 additions and 7 deletions

View File

@ -90,6 +90,12 @@ K9s is available on Linux, macOS and Windows platforms.
export TERM=xterm-256color
```
* In order to issue manifest edit commands make sure your EDITOR env is set.
```shell
export EDITOR=my_fav_editor_here!
```
---
## Screenshots
@ -129,6 +135,7 @@ K9s is available on Linux, macOS and Windows platforms.
## Demo Videos/Recordings
* [K9s v0.18.0](https://www.youtube.com/watch?v=zMnD5e53yRw)
* [K9s v0.17.0](https://www.youtube.com/watch?v=7S33CNLAofk&feature=youtu.be)
* [K9s Pulses](https://asciinema.org/a/UbXKPal6IWpTaVAjBBFmizcGN)
* [K9s v0.15.1](https://youtu.be/7Fx4XQ2ftpM)

View File

@ -0,0 +1,28 @@
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s_small.png" align="right" width="200" height="auto"/>
# Release v0.18.2
## Notes
Thank you to all that contributed with flushing out issues and enhancements for K9s! I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev and see if we're happier with some of the fixes! If you've filed an issue please help me verify and close. Your support, kindness and awesome suggestions to make K9s better is as ever very much noticed and appreciated!
Also if you dig this tool, please consider sponsoring 👆us or make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/enQtOTA5MDEyNzI5MTU0LWQ1ZGI3MzliYzZhZWEyNzYxYzA3NjE0YTk1YmFmNzViZjIyNzhkZGI0MmJjYzhlNjdlMGJhYzE2ZGU1NjkyNTM)
---
Maintenance Release!
## Oops!
Forgot to link my glorious [video](https://www.youtube.com/watch?v=zMnD5e53yRw)!!
Just a quick cleanup and added a cursor for command and search prompts (Thanks Kyle!)
## Resolved Bugs/Features/PRs
---
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2020 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

2
go.mod
View File

@ -30,7 +30,7 @@ replace (
require (
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/atotto/clipboard v0.1.2
github.com/derailed/tview v0.3.8
github.com/derailed/tview v0.3.9
github.com/drone/envsubst v1.0.2 // indirect
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect

2
go.sum
View File

@ -130,6 +130,8 @@ github.com/derailed/tview v0.3.7 h1:q0eYai9blR6wAWz/+lo2Knacl/Pnv9YSfI4aYme1aok=
github.com/derailed/tview v0.3.7/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII=
github.com/derailed/tview v0.3.8 h1:P5UmN8piZ8SbbvdPF2gnGd2dNaU6xLZtyYFCgrbrELQ=
github.com/derailed/tview v0.3.8/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII=
github.com/derailed/tview v0.3.9 h1:6iUtOmzN6gdk6yx1KNSwhMgrsLYjgldduulKPqHnqwk=
github.com/derailed/tview v0.3.9/go.mod h1:GJ3k/TIzEE+sj1L09/usk6HrkjsdadSsb03eHgPbcII=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=

View File

@ -108,6 +108,7 @@ func (a *App) bindKeys() {
tcell.KeyBackspace: NewKeyAction("Erase", a.eraseCmd, false),
tcell.KeyDelete: NewKeyAction("Erase", a.eraseCmd, false),
tcell.KeyCtrlU: NewSharedKeyAction("Clear Filter", a.clearCmd, false),
tcell.KeyCtrlQ: NewSharedKeyAction("Clear Filter", a.clearCmd, false),
}
}

View File

@ -26,8 +26,9 @@ type Command struct {
// NewCommand returns a new command view.
func NewCommand(styles *config.Styles, m *model.FishBuff) *Command {
c := Command{styles: styles, TextView: tview.NewTextView(), model: m}
c := Command{styles: styles, TextView: tview.NewTextView(), model: m, suggestionIndex: -1}
c.SetWordWrap(true)
c.ShowCursor(true)
c.SetWrap(true)
c.SetDynamicColors(true)
c.SetBorder(true)
@ -88,7 +89,8 @@ func (c *Command) InCmdMode() bool {
}
func (c *Command) activate() {
c.write(c.text)
c.SetCursorIndex(len(c.text))
c.write(c.text, "")
}
func (c *Command) update(s string) {
@ -97,16 +99,21 @@ func (c *Command) update(s string) {
}
c.text = s
c.Clear()
c.write(c.text)
c.write(s, "")
}
func (c *Command) suggest(text, suggestion string) {
c.Clear()
c.write(text + "[gray::-]" + suggestion)
c.write(text, suggestion)
}
func (c *Command) write(s string) {
fmt.Fprintf(c, defaultPrompt, c.icon, s)
func (c *Command) write(text, suggest string) {
c.SetCursorIndex(4 + len(text))
txt := text
if suggest != "" {
txt += "[gray::-]" + suggest
}
fmt.Fprintf(c, defaultPrompt, c.icon, txt)
}
// ----------------------------------------------------------------------------

View File

@ -117,6 +117,7 @@ func (d *Details) bindKeys() {
ui.KeyShiftN: ui.NewKeyAction("Prev Match", d.prevCmd, true),
ui.KeySlash: ui.NewSharedKeyAction("Filter Mode", d.activateCmd, false),
tcell.KeyCtrlU: ui.NewSharedKeyAction("Clear Filter", d.clearCmd, false),
tcell.KeyCtrlW: ui.NewSharedKeyAction("Clear Filter", d.clearCmd, false),
tcell.KeyBackspace2: ui.NewSharedKeyAction("Erase", d.eraseCmd, false),
tcell.KeyBackspace: ui.NewSharedKeyAction("Erase", d.eraseCmd, false),
tcell.KeyDelete: ui.NewSharedKeyAction("Erase", d.eraseCmd, false),

View File

@ -111,6 +111,7 @@ func (x *Xray) bindKeys() {
tcell.KeyBackspace: ui.NewSharedKeyAction("Erase", x.eraseCmd, false),
tcell.KeyDelete: ui.NewSharedKeyAction("Erase", x.eraseCmd, false),
tcell.KeyCtrlU: ui.NewSharedKeyAction("Clear Filter", x.clearCmd, false),
tcell.KeyCtrlW: ui.NewSharedKeyAction("Clear Filter", x.clearCmd, false),
tcell.KeyEscape: ui.NewSharedKeyAction("Filter Reset", x.resetCmd, false),
})
}