-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
60 lines (53 loc) · 1.19 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
package main
import (
"io/ioutil"
"log"
"os"
"time"
"github.com/urfave/cli/v2"
)
const (
version = "0.0.1"
)
func main() {
app := cli.NewApp()
app.Name = "Google form XLSX to JSON Converter for tools.tldr.run!"
app.Version = version
app.EnableBashCompletion = true
app.Authors = []*cli.Author{{Name: "Madhu Akula"}}
app.Usage = "An utility to perform custom google form xlsx to json convertion for tools.tldr.run."
app.Before = func(context *cli.Context) error {
if context.Bool("verbose") {
log.SetFlags(0)
} else {
log.SetOutput(ioutil.Discard)
}
return nil
}
app.Compiled = time.Now()
app.Commands = []*cli.Command{
{
Name: "convert",
Aliases: []string{"c"},
Usage: "Convert XLSX to JSON",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "input",
Aliases: []string{"i"},
Usage: "Specify input XLSX file path",
},
// &cli.StringFlag{
// Name: "output",
// Aliases: []string{"o"},
// Usage: "Specify output JSON file path",
// },
},
Action: handleError(checkRequired(convertXLSXToJSON, "input")),
},
}
err := app.Run(os.Args)
if err != nil {
// Run with '--help' for usage.
log.Fatal(err)
}
}