cleaning up
parent
757479e281
commit
e43260ed05
|
|
@ -292,8 +292,8 @@ func NewStyles() *Styles {
|
|||
}
|
||||
}
|
||||
|
||||
// LoadDefaults loads the default skin
|
||||
func (s *Styles) DefaultSkins() {
|
||||
// DefaultSkin loads the default skin
|
||||
func (s *Styles) DefaultSkin() {
|
||||
s.K9s = newStyle()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ type Configurator struct {
|
|||
Bench *config.Bench
|
||||
}
|
||||
|
||||
// HasSkins returns true if a skin file was located.
|
||||
func (c *Configurator) HasSkins() bool {
|
||||
// HasSkin returns true if a skin file was located.
|
||||
func (c *Configurator) HasSkin() bool {
|
||||
return c.skinFile != ""
|
||||
}
|
||||
|
||||
// StylesUpdater watches for skin file changes.
|
||||
func (c *Configurator) StylesUpdater(ctx context.Context, s synchronizer) error {
|
||||
if !c.HasSkins() {
|
||||
if !c.HasSkin() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -103,8 +103,8 @@ func (c *Configurator) RefreshStyles(context string) {
|
|||
|
||||
func (c *Configurator) updateStyles(f string) {
|
||||
c.skinFile = f
|
||||
if !c.HasSkins() {
|
||||
c.Styles.DefaultSkins()
|
||||
if !c.HasSkin() {
|
||||
c.Styles.DefaultSkin()
|
||||
}
|
||||
c.Styles.Update()
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ func TestConfiguratorRefreshStyle(t *testing.T) {
|
|||
cfg := ui.Configurator{}
|
||||
cfg.RefreshStyles("")
|
||||
|
||||
assert.True(t, cfg.HasSkins())
|
||||
assert.True(t, cfg.HasSkin())
|
||||
assert.Equal(t, tcell.ColorGhostWhite, render.StdColor)
|
||||
assert.Equal(t, tcell.ColorWhiteSmoke, render.ErrColor)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ func (t *Tree) ExtraHints() map[string]string {
|
|||
return nil
|
||||
}
|
||||
|
||||
// BindKeys binds default mnemonics.
|
||||
func (t *Tree) BindKeys() {
|
||||
t.Actions().Add(KeyActions{
|
||||
KeySpace: NewKeyAction("Expand/Collapse", t.noopCmd, true),
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ type NodeSpec struct {
|
|||
GVRs, Paths, Statuses []string
|
||||
}
|
||||
|
||||
// ParentGVR returns the parent GVR.
|
||||
func (s NodeSpec) ParentGVR() *string {
|
||||
if len(s.GVRs) > 1 {
|
||||
return &s.GVRs[1]
|
||||
|
|
@ -62,6 +63,7 @@ func (s NodeSpec) ParentGVR() *string {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ParentPath returns the parent path.
|
||||
func (s NodeSpec) ParentPath() *string {
|
||||
if len(s.Paths) > 1 {
|
||||
return &s.Paths[1]
|
||||
|
|
|
|||
Loading…
Reference in New Issue