blob: 3bd763f478437dc5d8b33bf11c35db19dfabdcab (
plain)
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
|
package main
import (
"flag"
"fmt"
"os"
)
type command interface {
execute() error
parse(arguments []string)
}
func main() {
flag.Usage = usage
if len(os.Args) == 1 {
usage()
}
var cmd command
switch os.Args[1] {
case "merge":
cmd = &mergeCommand{}
cmd.parse(os.Args[2:])
case "constants":
cmd = &constantsCommand{}
cmd.parse(os.Args[2:])
default:
cmd = &mergeCommand{}
cmd.parse(os.Args[1:])
}
if err := cmd.execute(); err != nil {
fmt.Println(err.Error())
os.Exit(1)
}
}
func usage() {
fmt.Printf(`goi18n manages translation files.
Usage:
goi18n merge Merge translation files
goi18n constants Generate constant file from translation file
For more details execute:
goi18n [command] -help
`)
os.Exit(1)
}
|