mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
fix(export): fail on invalid config option
This commit is contained in:
parent
05fe2e4159
commit
fb16d7c417
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jandedobbeleer/oh-my-posh/src/engine"
|
"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)
|
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 {
|
if len(output) == 0 {
|
||||||
fmt.Print(cfg.Export(format))
|
fmt.Print(cfg.Export(format))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue