-
Notifications
You must be signed in to change notification settings - Fork 74
/
legacypoliteia.go
53 lines (46 loc) · 1.05 KB
/
legacypoliteia.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
// Copyright (c) 2022 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"flag"
"fmt"
"os"
)
const (
// Command names. See the usage.go file for details on command usage.
convertCmdName = "convert"
importCmdName = "import"
// filePermissions is the file permissions that are used for all directory
// and file creation in this tool.
filePermissions = 0755
)
func _main() error {
// Parse the CLI args
flag.Parse()
args := flag.Args()
if len(args) == 0 {
fmt.Fprintln(os.Stderr, usageMsg)
return fmt.Errorf("no command specified")
}
// Execute the specified command
switch args[0] {
case convertCmdName:
return execConvertCmd(args[1:])
case importCmdName:
return execImportCmd(args[1:])
default:
return fmt.Errorf("command '%v' not found", args[0])
}
}
func main() {
// Use a custom help message
flag.Usage = func() {
fmt.Fprintln(os.Stderr, usageMsg)
}
err := _main()
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}