-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (46 loc) · 886 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
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"context"
"log"
"os"
"github.com/averak/protobq/internal"
"github.com/urfave/cli"
)
func main() {
if err := newCliApp().Run(os.Args); err != nil {
log.Fatal(err)
}
}
func newCliApp() *cli.App {
res := cli.NewApp()
res.Name = "protobq"
res.Usage = "A tool for idempotent schema management in BigQuery using Protocol Buffers."
res.Commands = []cli.Command{
{
Name: "apply",
Usage: "apply schema",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "project-id",
Required: true,
},
},
Action: func(c *cli.Context) error {
err := internal.Apply(context.Background(), c.String("project-id"))
if err != nil {
return err
}
return nil
},
},
{
Name: "drop",
Usage: "drop schema",
Action: func(c *cli.Context) error {
// TODO: implements me
return nil
},
},
}
return res
}