diff --git a/src/cli/config_export.go b/src/cli/config_export.go index 67af7573..4cd756af 100644 --- a/src/cli/config_export.go +++ b/src/cli/config_export.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path/filepath" + "slices" "strings" "github.com/jandedobbeleer/oh-my-posh/src/engine" @@ -49,6 +50,12 @@ Exports the ~/myconfig.omp.json config file to toml and prints the result to std os.Exit(2) } + formats := []string{"json", "jsonc", "toml", "tml", "yaml", "yml"} + if len(format) != 0 && !slices.Contains(formats, format) { + // usage error + os.Exit(2) + } + if len(output) == 0 { fmt.Print(cfg.Export(format)) return