mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
6fd9f0bdd9
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
50 lines
826 B
Go
Executable file
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()
|
|
}
|