From 7e2dab2a663564c83e6172d7e80d1e51a67fe98b Mon Sep 17 00:00:00 2001 From: derailed Date: Sat, 7 Aug 2021 07:29:47 -0600 Subject: [PATCH] cleaning up --- internal/dao/log_items.go | 2 +- internal/dao/pod.go | 1 + internal/model/types.go | 2 ++ internal/view/browser.go | 1 + internal/view/details.go | 1 + internal/view/live_view.go | 1 + internal/view/pulse.go | 1 + internal/view/sanitizer.go | 1 + internal/view/xray.go | 1 + 9 files changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/dao/log_items.go b/internal/dao/log_items.go index e54b6444..d50b401a 100644 --- a/internal/dao/log_items.go +++ b/internal/dao/log_items.go @@ -35,7 +35,7 @@ func NewLogItems() *LogItems { } } -// Len returns the items length. +// Items returns the log items. func (l *LogItems) Items() []*LogItem { l.mx.RLock() defer l.mx.RUnlock() diff --git a/internal/dao/pod.go b/internal/dao/pod.go index 8eb34484..d4184ba9 100644 --- a/internal/dao/pod.go +++ b/internal/dao/pod.go @@ -501,6 +501,7 @@ func (p *Pod) isControlled(path string) (string, bool, error) { return "", false, nil } +// GetDefaultLogContainer returns a container name if specified in an annotation. func GetDefaultLogContainer(m metav1.ObjectMeta, spec v1.PodSpec) (string, bool) { defaultContainer, ok := m.Annotations[defaultLogContainerAnnotation] if ok { diff --git a/internal/model/types.go b/internal/model/types.go index 25e36ee2..7b04da10 100644 --- a/internal/model/types.go +++ b/internal/model/types.go @@ -68,7 +68,9 @@ type Primitive interface { Name() string } +// Commander tracks prompt status. type Commander interface { + // InCmdMode checks if prompt is active. InCmdMode() bool } diff --git a/internal/view/browser.go b/internal/view/browser.go index 43602f5a..72b62940 100644 --- a/internal/view/browser.go +++ b/internal/view/browser.go @@ -82,6 +82,7 @@ func (b *Browser) Init(ctx context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (b *Browser) InCmdMode() bool { return b.CmdBuff().InCmdMode() } diff --git a/internal/view/details.go b/internal/view/details.go index aae1c4c7..2157035f 100644 --- a/internal/view/details.go +++ b/internal/view/details.go @@ -75,6 +75,7 @@ func (d *Details) Init(_ context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (d *Details) InCmdMode() bool { return d.cmdBuff.InCmdMode() } diff --git a/internal/view/live_view.go b/internal/view/live_view.go index f15723b4..40da2f0d 100644 --- a/internal/view/live_view.go +++ b/internal/view/live_view.go @@ -80,6 +80,7 @@ func (v *LiveView) Init(_ context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (v *LiveView) InCmdMode() bool { return v.cmdBuff.InCmdMode() } diff --git a/internal/view/pulse.go b/internal/view/pulse.go index e5306cc1..e7feddf3 100644 --- a/internal/view/pulse.go +++ b/internal/view/pulse.go @@ -108,6 +108,7 @@ func (p *Pulse) Init(ctx context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (*Pulse) InCmdMode() bool { return false } diff --git a/internal/view/sanitizer.go b/internal/view/sanitizer.go index 65c31ff0..19863c7d 100644 --- a/internal/view/sanitizer.go +++ b/internal/view/sanitizer.go @@ -84,6 +84,7 @@ func (s *Sanitizer) Init(ctx context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (*Sanitizer) InCmdMode() bool { return false } diff --git a/internal/view/xray.go b/internal/view/xray.go index 8d10b3e0..1de442d0 100644 --- a/internal/view/xray.go +++ b/internal/view/xray.go @@ -92,6 +92,7 @@ func (x *Xray) Init(ctx context.Context) error { return nil } +// InCmdMode checks if prompt is active. func (*Xray) InCmdMode() bool { return false }