feat(os): allow overriding distro name

resolves #5011
This commit is contained in:
Jan De Dobbeleer 2024-06-06 14:34:06 +02:00 committed by Jan De Dobbeleer
parent 2b47173cdb
commit 523cd98e1a
2 changed files with 9 additions and 1 deletions

View file

@ -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)

View file

@ -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)