oh-my-posh/segment_os.go

39 lines
741 B
Go
Raw Normal View History

2020-10-07 12:01:03 -07:00
package main
type osInfo struct {
2020-10-09 03:51:22 -07:00
props *properties
env environmentInfo
2020-10-07 12:01:03 -07:00
}
const (
2020-10-09 03:51:22 -07:00
//MacOS the string/icon to use for MacOS
MacOS Property = "macos"
//Linux the string/icon to use for linux
2020-10-07 12:01:03 -07:00
Linux Property = "linux"
2020-10-09 03:51:22 -07:00
//Windows the string/icon to use for windows
2020-10-07 12:01:03 -07:00
Windows Property = "windows"
)
func (n *osInfo) enabled() bool {
return true
}
func (n *osInfo) string() string {
goos := n.env.getRuntimeGOOS()
switch goos {
case "windows":
return n.props.getString(Windows, "\uE62A")
case "darwin":
2020-10-09 03:51:22 -07:00
return n.props.getString(MacOS, "\uF179")
2020-10-07 12:01:03 -07:00
case "linux":
return n.props.getString(Linux, "\uF17C")
default:
return ""
}
}
func (n *osInfo) init(props *properties, env environmentInfo) {
n.props = props
n.env = env
2020-10-09 03:51:22 -07:00
}