-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
39 lines (34 loc) · 882 Bytes
/
main.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
package main
import (
"context"
"log"
"os"
action "github.com/devdinu/gcloud-client/actions"
"github.com/devdinu/gcloud-client/command"
"github.com/devdinu/gcloud-client/config"
"github.com/devdinu/gcloud-client/gcloud"
"github.com/devdinu/gcloud-client/logger"
"github.com/devdinu/gcloud-client/store"
)
func main() {
config.MustLoad()
logger.SetLevel(config.LogLevel())
logger.SetOutput(os.Stdout)
args := config.GetArgs()
c := gcloud.NewClient(command.Executor{})
ctx := context.Background()
db, err := store.NewDB(config.GetDBFileName())
if err != nil {
log.Fatal(err)
}
defer db.Close()
action.MapActions(ctx, db)
action, err := action.GetAction(config.GetActionName())
if err != nil {
log.Fatal(err)
}
logger.Debugf("[gcloud-client] Executing action: %s", config.GetActionName())
if err := action(c, args); err != nil {
log.Fatal(err)
}
}