mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
parent
b174c27a5b
commit
ef8055eb08
|
@ -182,24 +182,28 @@ func (cfg *Config) Export(format string) string {
|
||||||
var result bytes.Buffer
|
var result bytes.Buffer
|
||||||
|
|
||||||
if cfg.format == JSON {
|
if cfg.format == JSON {
|
||||||
data := config.Data()
|
|
||||||
data["$schema"] = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
|
|
||||||
jsonEncoder := json2.NewEncoder(&result)
|
jsonEncoder := json2.NewEncoder(&result)
|
||||||
jsonEncoder.SetEscapeHTML(false)
|
jsonEncoder.SetEscapeHTML(false)
|
||||||
jsonEncoder.SetIndent("", " ")
|
jsonEncoder.SetIndent("", " ")
|
||||||
err := jsonEncoder.Encode(data)
|
err := jsonEncoder.Encode(cfg)
|
||||||
cfg.exitWithError(err)
|
cfg.exitWithError(err)
|
||||||
return escapeGlyphs(result.String())
|
prefix := "{\n \"$schema\": \"https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\","
|
||||||
|
data := strings.Replace(result.String(), "{", prefix, 1)
|
||||||
|
return escapeGlyphs(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := config.DumpTo(&result, cfg.format)
|
_, err := config.DumpTo(&result, cfg.format)
|
||||||
cfg.exitWithError(err)
|
cfg.exitWithError(err)
|
||||||
if cfg.format == YAML {
|
switch cfg.format {
|
||||||
|
case YAML:
|
||||||
prefix := "# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n"
|
prefix := "# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n"
|
||||||
return prefix + result.String()
|
return prefix + result.String()
|
||||||
|
case TOML:
|
||||||
|
prefix := "#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n"
|
||||||
|
return prefix + escapeGlyphs(result.String())
|
||||||
|
default:
|
||||||
|
return result.String()
|
||||||
}
|
}
|
||||||
prefix := "#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json\n\n"
|
|
||||||
return prefix + escapeGlyphs(result.String())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *Config) BackupAndMigrate(env environment.Environment) {
|
func (cfg *Config) BackupAndMigrate(env environment.Environment) {
|
||||||
|
|
Loading…
Reference in a new issue