-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
75 lines (71 loc) · 1.71 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package main
import (
"os"
"github.com/yoheimuta/dbq/command/query"
"github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Name = "dbq"
app.Usage = "CLI tool to decorate bigquery table"
app.Version = "0.0.3"
app.EnableBashCompletion = true
app.Commands = []cli.Command{
{
Name: "query",
ShortName: "q",
Usage: "Run bq query with complementing table range decorator",
Flags: []cli.Flag{
cli.Float64Flag{
Name: "beforeHour",
Value: 3,
Usage: "a decimal to specify the hour ago, relative to the current time",
},
cli.StringFlag{
Name: "startDate",
Value: "",
Usage: "a datetime to specify date range with end flag",
},
cli.StringFlag{
Name: "endDate",
Value: "",
Usage: "a datetime to specify date range with start flag",
},
cli.Float64Flag{
Name: "tz",
Value: 0,
Usage: "a decimal of hour or -hour to add to start and end datetime, considering timezone",
},
cli.Float64Flag{
Name: "buffer",
Value: 1,
Usage: "a decimal of hour to add to start and end datetime, it's heuristic value",
},
cli.StringFlag{
Name: "gflags",
Value: "",
Usage: "no support. Use onlyStatement instead",
},
cli.StringFlag{
Name: "cflags",
Value: "",
Usage: "no support. Use onlyStatement instead",
},
cli.BoolFlag{
Name: "verbose",
Usage: "a flag to output verbosely",
},
cli.BoolFlag{
Name: "dryRun",
Usage: "a flag to run without any changes",
},
cli.BoolFlag{
Name: "onlyStatement",
Usage: "a flag to output only a decorated statement",
},
},
Action: query.Run,
},
}
app.Run(os.Args)
}