diff options
Diffstat (limited to 'poe.go')
-rw-r--r-- | poe.go | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -10,20 +10,34 @@ import ( "github.com/prodhe/poe/ui" ) +const poeVersion = "0.0.0" + func main() { + version := flag.Bool("v", false, "prints current version of poe") + cli := flag.Bool("c", false, "prints current version of poe") + flag.Parse() - e := editor.New() + if *version { + fmt.Println(poeVersion) + os.Exit(0) + } + // new editor with loaded files + e := editor.New() e.LoadBuffers(flag.Args()) - ui := ui.NewTcell() - //ui := ui.NewCli() - ui.Init(e) + // load client user interface + cui := ui.NewTcell() + if *cli { + cui = ui.NewCli() + } + + cui.Init(e) // close ui and show stack trace on panic defer func() { - ui.Close() + cui.Close() if err := recover(); err != nil { buf := make([]byte, 1<<16) @@ -35,5 +49,5 @@ func main() { }() // This will loop and listen on chosen UI. - ui.Listen() + cui.Listen() } |