From 13d52f120f8ac17fc3ba8ee4930ee8b07c395054 Mon Sep 17 00:00:00 2001 From: derailed Date: Sat, 7 Aug 2021 07:24:34 -0600 Subject: [PATCH] cleaning up --- internal/config/config.go | 2 +- internal/config/k9s.go | 2 +- internal/view/cow.go | 1 + internal/view/env.go | 2 +- internal/view/help.go | 1 + internal/view/log.go | 1 + internal/view/picker.go | 1 + internal/view/table.go | 1 + 8 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index d001d28e..0118da7f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,12 +7,12 @@ import ( "os" "path/filepath" + "github.com/adrg/xdg" "github.com/derailed/k9s/internal/client" "github.com/rs/zerolog/log" "gopkg.in/yaml.v2" v1 "k8s.io/api/core/v1" "k8s.io/cli-runtime/pkg/genericclioptions" - "github.com/adrg/xdg" ) // K9sConfig represents K9s configuration dir env var. diff --git a/internal/config/k9s.go b/internal/config/k9s.go index ca8e5e3e..c84c0ece 100644 --- a/internal/config/k9s.go +++ b/internal/config/k9s.go @@ -43,7 +43,7 @@ func NewK9s() *K9s { } } -// ActiveCluster initializes the active cluster is not present. +// ActivateCluster initializes the active cluster is not present. func (k *K9s) ActivateCluster() { if _, ok := k.Clusters[k.CurrentCluster]; ok { return diff --git a/internal/view/cow.go b/internal/view/cow.go index 97173060..c8f13135 100644 --- a/internal/view/cow.go +++ b/internal/view/cow.go @@ -53,6 +53,7 @@ func (c *Cow) Init(_ context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (*Cow) InCmdMode() bool { return false } diff --git a/internal/view/env.go b/internal/view/env.go index 29ecfeab..dd61bd00 100644 --- a/internal/view/env.go +++ b/internal/view/env.go @@ -23,7 +23,7 @@ func (e Env) Substitute(arg string) (string, error) { // To prevent the substitution starts with the shorter environment variable, // sort with the length of the found environment variables. - sort.Slice(kk, func (i, j int) bool { + sort.Slice(kk, func(i, j int) bool { return len(kk[i]) > len(kk[j]) }) diff --git a/internal/view/help.go b/internal/view/help.go index 823eda70..8517eff9 100644 --- a/internal/view/help.go +++ b/internal/view/help.go @@ -59,6 +59,7 @@ func (h *Help) Init(ctx context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (*Help) InCmdMode() bool { return false } diff --git a/internal/view/log.go b/internal/view/log.go index b91bedda..eed7a5c9 100644 --- a/internal/view/log.go +++ b/internal/view/log.go @@ -98,6 +98,7 @@ func (l *Log) Init(ctx context.Context) (err error) { return nil } +// InCmdMode checks if prompt is active. func (v *Log) InCmdMode() bool { return v.logs.cmdBuff.InCmdMode() } diff --git a/internal/view/picker.go b/internal/view/picker.go index 730311a8..de846a35 100644 --- a/internal/view/picker.go +++ b/internal/view/picker.go @@ -49,6 +49,7 @@ func (p *Picker) Init(ctx context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (*Picker) InCmdMode() bool { return false } diff --git a/internal/view/table.go b/internal/view/table.go index bb178625..d941a07f 100644 --- a/internal/view/table.go +++ b/internal/view/table.go @@ -52,6 +52,7 @@ func (t *Table) Init(ctx context.Context) (err error) { return nil } +// HeaderIndex returns index of a given column or false if not found. func (t *Table) HeaderIndex(header string) (int, bool) { for i := 0; i < t.GetColumnCount(); i++ { if h := t.GetCell(0, i); h != nil && h.Text == header {