mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(cli): use correct exit codes
This commit is contained in:
parent
17dd5c8b58
commit
67042ffa50
|
@ -44,6 +44,11 @@ Exports the ~/myconfig.omp.json config file to toml and prints the result to std
|
|||
defer env.Close()
|
||||
cfg := engine.LoadConfig(env)
|
||||
|
||||
if len(output) == 0 && len(format) == 0 {
|
||||
// usage error
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
if len(output) == 0 {
|
||||
fmt.Print(cfg.Export(format))
|
||||
return
|
||||
|
@ -63,7 +68,8 @@ Exports the ~/myconfig.omp.json config file to toml and prints the result to std
|
|||
case "yaml", "yml":
|
||||
format = engine.YAML
|
||||
default:
|
||||
os.Exit(1)
|
||||
// data error
|
||||
os.Exit(65)
|
||||
}
|
||||
|
||||
cfg.Write(format)
|
||||
|
|
|
@ -36,7 +36,8 @@ on getting started, have a look at the docs at https://ohmyposh.dev`,
|
|||
|
||||
func Execute() {
|
||||
if err := RootCmd.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
// software error
|
||||
os.Exit(70)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ func (cfg *Config) Write(format string) {
|
|||
content := cfg.Export(format)
|
||||
if len(content) == 0 {
|
||||
// we are unable to perform the export
|
||||
os.Exit(1)
|
||||
os.Exit(65)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -272,6 +272,6 @@ func Run(font string, system bool) {
|
|||
program = tea.NewProgram(main)
|
||||
if _, err := program.Run(); err != nil {
|
||||
print("Error running program: %v", err)
|
||||
os.Exit(1)
|
||||
os.Exit(70)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue