-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplanor.go
45 lines (35 loc) · 838 Bytes
/
planor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"flag"
// "io/ioutil"
// "log"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/mrusme/planor/nori"
"github.com/mrusme/planor/ui"
"github.com/mrusme/planor/ui/uictx"
)
func main() {
var cloudProvider = "aws"
var cloudProfile = ""
flag.StringVar(&cloudProvider, "c", "aws",
"cloud provider: aws, vultr, heroku")
flag.StringVar(&cloudProfile, "p", "",
"aws profile name, vultr/heroku/render/fleek api key env variable name")
flag.Parse()
if cloudProvider == "" || cloudProfile == "" {
flag.Usage()
os.Exit(1)
}
cloud, err := nori.New(&cloudProvider, &cloudProfile)
if err != nil {
panic(err)
}
ctx := uictx.New(&cloud)
// log.SetOutput(ioutil.Discard)
tui := tea.NewProgram(ui.NewModel(&ctx), tea.WithAltScreen())
err = tui.Start()
if err != nil {
panic(err)
}
}