mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-28 03:21:26 -08:00
35 lines
655 B
Go
35 lines
655 B
Go
package main
|
|
|
|
import "strings"
|
|
|
|
type shell struct {
|
|
props *properties
|
|
env environmentInfo
|
|
}
|
|
|
|
const (
|
|
// MappedShellNames allows for custom text in place of shell names
|
|
MappedShellNames Property = "mapped_shell_names"
|
|
)
|
|
|
|
func (s *shell) enabled() bool {
|
|
return true
|
|
}
|
|
|
|
func (s *shell) string() string {
|
|
mappedNames := s.props.getKeyValueMap(MappedShellNames, make(map[string]string))
|
|
shellName := s.env.getShellName()
|
|
for key, val := range mappedNames {
|
|
if strings.EqualFold(shellName, key) {
|
|
shellName = val
|
|
break
|
|
}
|
|
}
|
|
return shellName
|
|
}
|
|
|
|
func (s *shell) init(props *properties, env environmentInfo) {
|
|
s.props = props
|
|
s.env = env
|
|
}
|