mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
parent
344c9b6d86
commit
3a580ff122
|
@ -133,12 +133,17 @@ func loadConfig(env platform.Environment) *Config {
|
||||||
cfg.origin = configFile
|
cfg.origin = configFile
|
||||||
cfg.Format = strings.TrimPrefix(filepath.Ext(configFile), ".")
|
cfg.Format = strings.TrimPrefix(filepath.Ext(configFile), ".")
|
||||||
cfg.env = env
|
cfg.env = env
|
||||||
if cfg.Format == "yml" {
|
|
||||||
|
// support different extensions
|
||||||
|
switch cfg.Format {
|
||||||
|
case "yml":
|
||||||
cfg.Format = YAML
|
cfg.Format = YAML
|
||||||
|
case "jsonc":
|
||||||
|
cfg.Format = JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
config.AddDriver(yaml.Driver)
|
config.AddDriver(yaml.Driver.WithAliases("yaml", "yml"))
|
||||||
config.AddDriver(json.Driver)
|
config.AddDriver(json.Driver.WithAliases("json", "jsonc"))
|
||||||
config.AddDriver(toml.Driver)
|
config.AddDriver(toml.Driver)
|
||||||
|
|
||||||
if config.Default().IsEmpty() {
|
if config.Default().IsEmpty() {
|
||||||
|
|
|
@ -632,9 +632,10 @@ func (env *Shell) Flags() *Flags {
|
||||||
|
|
||||||
func (env *Shell) Shell() string {
|
func (env *Shell) Shell() string {
|
||||||
defer env.Trace(time.Now())
|
defer env.Trace(time.Now())
|
||||||
if env.CmdFlags.Shell != "" {
|
if len(env.CmdFlags.Shell) != 0 {
|
||||||
return env.CmdFlags.Shell
|
return env.CmdFlags.Shell
|
||||||
}
|
}
|
||||||
|
env.Debug("no shell name provided in flags, trying to detect it")
|
||||||
pid := os.Getppid()
|
pid := os.Getppid()
|
||||||
p, _ := process.NewProcess(int32(pid))
|
p, _ := process.NewProcess(int32(pid))
|
||||||
name, err := p.Name()
|
name, err := p.Name()
|
||||||
|
|
Loading…
Reference in a new issue