/
cmd.go
44 lines (35 loc) · 1018 Bytes
/
cmd.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
// Scry Info. All rights reserved.
// license that can be found in the license file.
package dot
import (
"flag"
)
//Cmd type general command line parameters
type Cmd struct {
//ConfigPath config file path
ConfigPath string
//ConfigFile config file name without path
ConfigFile string
}
//GCmd Global variables general command line parameters
var GCmd Cmd
//CmdParameterName Command line parameter name
type CmdParameterName string
func (c CmdParameterName) String() string {
return string(c)
}
//Command line parameters
const (
//Config file path, add Cmd to show relations with struct cmd
CmdConfigPath CmdParameterName = "configpath"
//Config file name without path
CmdConfigFile CmdParameterName = "configfile"
)
//FlagDefines General command parameter initialization
func FlagDefines() {
flag.StringVar(&GCmd.ConfigPath, CmdConfigPath.String(), "", "config path")
flag.StringVar(&GCmd.ConfigFile, CmdConfigFile.String(), "", "config file, not include path")
}
func init() {
FlagDefines()
}