-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
53 lines (46 loc) · 1005 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
51
52
53
package main
import (
"fmt"
"os"
"github.com/urfave/cli"
"github.com/wonsikin/icotjo/parser"
)
const (
// AppVersion the version of this app.
AppVersion = "v1.0.1"
)
func main() {
app := cli.NewApp()
app.Version = AppVersion
app.Name = "icotjo"
app.HelpName = "icotjo"
app.Usage = "a utility for parse i18n.csv to i18n json file"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "input, i",
Value: "./I18N.csv",
Usage: "where is the i18n.csv file",
},
cli.StringFlag{
Name: "output, o",
Value: "./",
Usage: "the output of the json file that was generated",
},
cli.BoolFlag{
Name: "unsort, u",
Hidden: false,
Usage: "the input file will not be sorted by key if true",
},
}
app.Action = func(c *cli.Context) error {
err := parser.Parser(c.String("input"), c.String("output"), c.Bool("unsort"))
if err != nil {
return fmt.Errorf("%v", err)
}
return nil
}
err := app.Run(os.Args)
if err != nil {
fmt.Printf("[Error] %v", err)
}
}