/
flags.go
40 lines (32 loc) · 1.39 KB
/
flags.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
package cli
import (
flag "github.com/spf13/pflag"
"github.com/bianjieai/iritamod/modules/node/types"
)
const (
FlagName = "name"
FlagCert = "cert"
FlagPower = "power"
FlagDescription = "description"
FlagNodeID = "node-id"
FlagIP = "ip"
)
// common flagsets to add to various functions
var (
FsCreateValidator = flag.NewFlagSet("", flag.ContinueOnError)
FsUpdateValidator = flag.NewFlagSet("", flag.ContinueOnError)
FsGrantNode = flag.NewFlagSet("", flag.ContinueOnError)
)
func init() {
FsCreateValidator.String(FlagName, "", "The name of the validator")
FsCreateValidator.String(FlagCert, "", "The certificate file path of the validator identity")
FsCreateValidator.Int64(FlagPower, 0, "The power of the validator")
FsCreateValidator.String(FlagDescription, "", "The validator's (optional) details")
FsCreateValidator.String(FlagNodeID, "", "The node's ID")
FsUpdateValidator.String(FlagCert, "", "The certificate file path of the validator identity")
FsUpdateValidator.Int64(FlagPower, 0, "The power of the validator")
FsUpdateValidator.String(FlagDescription, types.DoNotModifyDesc, "The validator's (optional) details")
FsUpdateValidator.String(FlagName, types.DoNotModifyDesc, "The alias name of the validator")
FsGrantNode.String(FlagName, "", "The alias name of the node")
FsGrantNode.String(FlagCert, "", "The certificate file path of the node identity")
}