refactor(main): move simple command up

This commit is contained in:
Jan De Dobbeleer 2021-12-30 22:23:45 +01:00 committed by Jan De Dobbeleer
parent 4960f8a2b7
commit 9b15054378

View file

@ -172,9 +172,17 @@ func main() {
"Print a plain prompt without ANSI"),
}
flag.Parse()
if *args.Version {
fmt.Println(Version)
return
}
env := &environment{}
env.init(args)
defer env.close()
if *args.PrintShell {
fmt.Println(env.getShellName())
return
}
if *args.Millis {
fmt.Print(time.Now().UnixNano() / 1000000)
return
@ -194,15 +202,6 @@ func main() {
return
}
cfg := GetConfig(env)
if *args.PrintShell {
fmt.Println(env.getShellName())
return
}
if *args.Version {
fmt.Println(Version)
return
}
ansi := &ansiUtils{}
ansi.init(env.getShellName())
var writer promptWriter