From 523cd98e1ab31a9407949edaf320e5c6a0196bb6 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 6 Jun 2024 14:34:06 +0200 Subject: [PATCH] feat(os): allow overriding distro name resolves #5011 --- src/segments/os.go | 2 +- src/segments/os_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/segments/os.go b/src/segments/os.go index ee2ab16e..8d06f49e 100644 --- a/src/segments/os.go +++ b/src/segments/os.go @@ -38,7 +38,7 @@ func (oi *Os) Enabled() bool { pf := oi.env.Platform() displayDistroName := oi.props.GetBool(DisplayDistroName, false) if displayDistroName { - oi.Icon = pf + oi.Icon = oi.props.GetString(properties.Property(pf), pf) break } oi.Icon = oi.getDistroIcon(pf) diff --git a/src/segments/os_test.go b/src/segments/os_test.go index e0e4db06..9495cfb3 100644 --- a/src/segments/os_test.go +++ b/src/segments/os_test.go @@ -76,6 +76,14 @@ func TestOSInfo(t *testing.T) { GOOS: "linux", Platform: "crazy", }, + { + Case: "show distro name, mapped", + ExpectedString: "<3", + DisplayDistroName: true, + GOOS: "linux", + Icon: "<3", + Platform: "love", + }, } for _, tc := range cases { env := new(mock.MockedEnvironment)