commit
b0285ca4be
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/atotto/clipboard"
|
||||||
"github.com/derailed/k9s/internal/config"
|
"github.com/derailed/k9s/internal/config"
|
||||||
"github.com/derailed/k9s/internal/ui"
|
"github.com/derailed/k9s/internal/ui"
|
||||||
"github.com/derailed/tview"
|
"github.com/derailed/tview"
|
||||||
|
|
@ -77,6 +78,7 @@ func (v *detailsView) bindKeys() {
|
||||||
tcell.KeyTab: ui.NewKeyAction("Next Match", v.nextCmd, false),
|
tcell.KeyTab: ui.NewKeyAction("Next Match", v.nextCmd, false),
|
||||||
tcell.KeyBacktab: ui.NewKeyAction("Previous Match", v.prevCmd, false),
|
tcell.KeyBacktab: ui.NewKeyAction("Previous Match", v.prevCmd, false),
|
||||||
tcell.KeyCtrlS: ui.NewKeyAction("Save", v.saveCmd, true),
|
tcell.KeyCtrlS: ui.NewKeyAction("Save", v.saveCmd, true),
|
||||||
|
ui.KeyC: ui.NewKeyAction("Copy", v.cpCmd, false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,6 +113,14 @@ func (v *detailsView) saveCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *detailsView) cpCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||||
|
v.app.Flash().Info("Content copied to clipboard...")
|
||||||
|
if err := clipboard.WriteAll(v.GetText(true)); err != nil {
|
||||||
|
v.app.Flash().Err(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (v *detailsView) backCmd(evt *tcell.EventKey) *tcell.EventKey {
|
func (v *detailsView) backCmd(evt *tcell.EventKey) *tcell.EventKey {
|
||||||
if !v.cmdBuff.Empty() {
|
if !v.cmdBuff.Empty() {
|
||||||
v.cmdBuff.Reset()
|
v.cmdBuff.Reset()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue