-
Notifications
You must be signed in to change notification settings - Fork 11
/
flags.go
38 lines (32 loc) · 1.52 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
// nolint
package cli
import (
flag "github.com/spf13/pflag"
"github.com/bianjieai/iritamod/modules/identity/types"
)
const (
FlagID = "id"
FlagPubKey = "pubkey"
FlagPubKeyAlgo = "pubkey-algo"
FlagCertificateFile = "cert-file"
FlagCredentials = "credentials"
FlagData = "data"
)
// common flagsets to add to various functions
var (
FsCreateIdentity = flag.NewFlagSet("", flag.ContinueOnError)
FsUpdateIdentity = flag.NewFlagSet("", flag.ContinueOnError)
)
func init() {
FsCreateIdentity.BytesHex(FlagID, nil, "ID of the identity with 32 hex characters, automatically generated if not provided")
FsCreateIdentity.BytesHex(FlagPubKey, nil, "hex encoded public key")
FsCreateIdentity.String(FlagPubKeyAlgo, "", "algorithm of the public key (rsa|dsa|ecdsa|ed25519|sm2)")
FsCreateIdentity.String(FlagCertificateFile, "", "X.509 certificate file path")
FsCreateIdentity.String(FlagCredentials, "", "uri pointing to credentials of the identity")
FsCreateIdentity.String(FlagData, "", "custom data of the identity")
FsUpdateIdentity.BytesHex(FlagPubKey, nil, "hex encoded public key to be added")
FsUpdateIdentity.String(FlagPubKeyAlgo, "", "algorithm of the public key (rsa|dsa|ecdsa|ed25519|sm2)")
FsUpdateIdentity.String(FlagCertificateFile, "", "file path of the X.509 certificate to be added")
FsUpdateIdentity.String(FlagCredentials, types.DoNotModifyDesc, "uri pointing to credentials of the identity")
FsUpdateIdentity.String(FlagData, types.DoNotModifyDesc, "custom data of the identity")
}