-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyflags.go
53 lines (42 loc) · 968 Bytes
/
myflags.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"
log "github.com/sirupsen/logrus"
flag "github.com/spf13/pflag"
"path"
)
var fInfile string
var fOutfile string
var fVerbose bool
var typeName string
var fDebug bool
func InitFlags() {
flag.StringVar(&typeName, "type", "record", "Name of record type conversion")
flag.StringVar(&fInfile, "infile", "", "ODS file to process")
flag.StringVar(&fOutfile, "outfile", "", "Output JSON file")
flag.BoolVar(&fVerbose, "verbose", true, "Lotsa information")
flag.BoolVar(&fDebug, "debug", false, "log data to STDERR as well as log file")
flag.Parse()
if ("" == fInfile) || ("" == fOutfile) {
fmt.Print("\n")
flag.Usage()
log.Exit(0)
}
fInfile = path.Clean(fInfile)
fOutfile = path.Clean(fOutfile)
}
func GetDebug() bool {
return fDebug
}
func GetTypeName() string {
return typeName
}
func GetInfile() string {
return fInfile
}
func GetOutfile() string {
return fOutfile
}
func GetVerbose() bool {
return fVerbose
}