oh-my-posh/main.go
Jan De Dobbeleer 6fd9f0bdd9 fix: render newline correctly cross platform/shell
Powershell has an issue rendering multiline prompts when it comes to
PSReadline on MacOS. To mitigate that, we make it a multiline
prompt by moving the cursor all the way to the end. That way, PSReadline
believes this is still a one line prompt and everything works as
expected.

https://github.com/PowerShell/PowerShell/issues/3687
2020-09-17 12:38:01 +02:00

50 lines
826 B
Go
Executable file

package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
)
type args struct {
ErrorCode *int
PrintConfig *bool
Config *string
}
func main() {
args := &args{
ErrorCode: flag.Int(
"error",
0,
"Error code of previously executed command"),
PrintConfig: flag.Bool(
"print-config",
false,
"Config prints the current settings in json format"),
Config: flag.String(
"config",
"",
"Add the path to a configuration you wish to load"),
}
flag.Parse()
env := &environment{
args: args,
}
settings := GetSettings(env)
if *args.PrintConfig {
theme, _ := json.MarshalIndent(settings, "", " ")
fmt.Println(string(theme))
return
}
engine := &engine{
settings: settings,
env: env,
renderer: &ColorWriter{
Buffer: new(bytes.Buffer),
},
}
engine.render()
}