Skip to content

Commit 2a84008

Browse files
Emoji replacements with k9s.json config strings
1 parent 350439b commit 2a84008

File tree

5 files changed

+51
-8
lines changed

5 files changed

+51
-8
lines changed

cmd/root.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func run(cmd *cobra.Command, args []string) error {
123123
}
124124

125125
func loadConfiguration() (*config.Config, error) {
126-
log.Info().Msg("🐶 K9s starting up...")
126+
log.Info().Msg(config.Config.K9s.UI.Icons.startupIcon + " K9s starting up...")
127127

128128
k8sCfg := client.NewConfig(k8sFlags)
129129
k9sCfg := config.NewConfig(k8sCfg)
@@ -150,7 +150,7 @@ func loadConfiguration() (*config.Config, error) {
150150
errs = errors.Join(errs, fmt.Errorf("k8s connection failed for context: %s", k9sCfg.K9s.ActiveContextName()))
151151
}
152152

153-
log.Info().Msg("✅ Kubernetes connectivity")
153+
log.Info().Msg(config.Config.K9s.UI.Icons.okIcon + " Kubernetes connectivity")
154154
if err := k9sCfg.Save(false); err != nil {
155155
log.Error().Err(err).Msg("Config save")
156156
errs = errors.Join(errs, err)

internal/config/json/schemas/k9s.json

+41
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,47 @@
2424
"logoless": {"type": "boolean"},
2525
"crumbsless": {"type": "boolean"},
2626
"noIcons": {"type": "boolean"},
27+
"icons": {
28+
"type": "object",
29+
"properties": {
30+
"clusterRolesIcon": {"type": "string", "default": "👩‍"},
31+
"commandBufferIcon": {"type": "string", "default": "🐶"},
32+
"configMapsIcon": {"type": "string", "default": "🗺 "},
33+
"containersIcon": {"type": "string", "default": "🐳"},
34+
"daemonSetsIcon": {"type": "string", "default": "😈"},
35+
"defaultIcon": {"type": "string", "default": "📎"},
36+
"deploymentsIcon": {"type": "string", "default": "🪂"},
37+
"dirIcon": {"type": "string", "default": "🦄 "},
38+
"errIcon": {"type": "string", "default": "😡"},
39+
"folderIcon": {"type": "string", "default": "📁 "},
40+
"horizontalPodAutoScalersIcon": {"type": "string", "default": "♎️"},
41+
"infoIcon": {"type": "string", "default": "😎"},
42+
"issue0Icon": {"type": "string", "default": "👍"},
43+
"issue1Icon": {"type": "string", "default": "🔊"},
44+
"issue2Icon": {"type": "string", "default": "☣️ "},
45+
"issue3Icon": {"type": "string", "default": "🧨"},
46+
"logCanceledIcon": {"type": "string", "default": "🏁"},
47+
"namespacesIcon": {"type": "string", "default": "🗂 "},
48+
"networkPoliciesIcon": {"type": "string", "default": "📕"},
49+
"nodesIcon": {"type": "string", "default": "🖥 "},
50+
"okIcon": {"type": "string", "default": ""},
51+
"otherBufferIcon": {"type": "string", "default": "🐩"},
52+
"persistentVolumeClaimsIcon": {"type": "string", "default": "🎟 "},
53+
"persistentVolumesIcon": {"type": "string", "default": "📚"},
54+
"podDisruptionBudgetsIcon": {"type": "string", "default": "🏷 "},
55+
"podSecurityPoliciesIcon": {"type": "string", "default": "👮‍♂️"},
56+
"podsIcon": {"type": "string", "default": "🚛"},
57+
"replicaSetsIcon": {"type": "string", "default": "👯‍♂️"},
58+
"reportIcon": {"type": "string", "default": "🧼"},
59+
"rolesIcon": {"type": "string", "default": "👨🏻‍"},
60+
"secretsIcon": {"type": "string", "default": "🔒"},
61+
"serviceAccountsIcon": {"type": "string", "default": "💳"},
62+
"servicesIcon": {"type": "string", "default": "💁‍♀️"},
63+
"startupIcon": {"type": "string", "default": "🐶"},
64+
"statefulSetsIcon": {"type": "string", "default": "🎎"},
65+
"warnIcon": {"type": "string", "default": "😗"}
66+
}
67+
},
2768
"reactive": {"type": "boolean"},
2869
"skin": {"type": "string"},
2970
"defaultsToFullScreen": {"type": "boolean"}

internal/render/dir.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"os"
99

10+
"github.com/derailed/k9s/internal/config"
1011
"github.com/derailed/k9s/internal/model1"
1112
"github.com/derailed/tcell/v2"
1213
"k8s.io/apimachinery/pkg/runtime"
@@ -43,9 +44,9 @@ func (Dir) Render(o interface{}, ns string, r *model1.Row) error {
4344
return fmt.Errorf("expected DirRes, but got %T", o)
4445
}
4546

46-
name := "🦄 "
47+
name := config.Config.K9s.UI.Icons.okIcon
4748
if d.Entry.IsDir() {
48-
name = "📁 "
49+
name = config.Config.K9s.UI.Icons.folderIcon
4950
}
5051
name += d.Entry.Name()
5152
r.ID, r.Fields = d.Path, append(r.Fields, name)

internal/ui/flash_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"testing"
99
"time"
1010

11+
"github.com/derailed/k9s/internal/config"
1112
"github.com/derailed/k9s/internal/config/mock"
1213
"github.com/derailed/k9s/internal/model"
1314
"github.com/derailed/k9s/internal/ui"
@@ -20,9 +21,9 @@ func TestFlash(t *testing.T) {
2021
l model.FlashLevel
2122
i, e string
2223
}{
23-
"info": {l: model.FlashInfo, i: "hello", e: "😎 hello\n"},
24-
"warn": {l: model.FlashWarn, i: "hello", e: "😗 hello\n"},
25-
"err": {l: model.FlashErr, i: "hello", e: "😡 hello\n"},
24+
"info": {l: model.FlashInfo, i: "hello", e: config.Config.K9s.UI.Icons.infoIcon + " hello\n"},
25+
"warn": {l: model.FlashWarn, i: "hello", e: config.Config.K9s.UI.Icons.warnIcon + " hello\n"},
26+
"err": {l: model.FlashErr, i: "hello", e: config.Config.K9s.UI.Icons.errIcon + " hello\n"},
2627
}
2728

2829
a := ui.NewApp(mock.NewMockConfig(), "test")

internal/view/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (l *Log) InCmdMode() bool {
114114
// LogCanceled indicates no more logs are coming.
115115
func (l *Log) LogCanceled() {
116116
log.Debug().Msgf("LOGS_CANCELED!!!")
117-
l.Flush([][]byte{[]byte("\n🏁 [red::b]Stream exited! No more logs...")})
117+
l.Flush([][]byte{[]byte("\n" + Config.config.K9s.UI.Icons.logCanceledIcon + "Stream exited! No more logs...")})
118118
}
119119

120120
// LogStop disables log flushes.

0 commit comments

Comments
 (0)