-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.go
126 lines (108 loc) · 3.47 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package main
import (
"time"
cli "github.com/urfave/cli/v2"
"github.com/urfave/cli/v2/altsrc"
"github.com/waku-org/go-waku/waku/cliutils"
)
var NodeKey = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
Name: "nodekey",
Usage: "P2P node private key as hex.",
Value: &cliutils.PrivateKeyValue{
Value: &options.NodeKey,
},
})
var ClusterID = altsrc.NewUintFlag(&cli.UintFlag{
Name: "cluster-id",
Value: 0,
Usage: "Cluster id that the node is running in. Node in a different cluster id is disconnected.",
Destination: &options.ClusterID,
})
var PubsubTopic = altsrc.NewStringFlag(&cli.StringFlag{
Name: "pubsub-topic",
Usage: "Query pubsub topic.",
Destination: &options.PubSubTopic,
})
var ContentTopic = altsrc.NewStringSliceFlag(&cli.StringSliceFlag{
Name: "content-topic",
Usage: "Query content topic. Argument may be repeated.",
Destination: &options.ContentTopics,
})
var StartTime = altsrc.NewInt64Flag(&cli.Int64Flag{
Name: "start-time",
Usage: "Query start time in nanoseconds",
Destination: &options.StartTime,
})
var EndTime = altsrc.NewInt64Flag(&cli.Int64Flag{
Name: "end-time",
Usage: "Query end time in nanoseconds",
Destination: &options.EndTime,
})
var Hashes = altsrc.NewStringSliceFlag(&cli.StringSliceFlag{
Name: "hash",
Usage: "Query by message hashes",
Destination: &options.Hashes,
})
var Pagesize = altsrc.NewUint64Flag(&cli.Uint64Flag{
Name: "pagesize",
Value: 20,
Usage: "Pagesize",
Destination: &options.PageSize,
})
var Forward = altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "forward",
Usage: "Indicates if the entries will be traversed in ascending order (true) or descending order (false)",
Destination: &options.Forward,
Value: false,
})
var Storenode = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
Name: "storenode",
Usage: "Multiaddr of a peer that supports store protocol",
Value: &cliutils.MultiaddrValue{
Value: &options.StoreNode,
},
Required: true,
})
/*
TODO
altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "advance-cursor",
Usage: "Advance cursor automatically",
Destination: &options.AdvanceCursor,
Value: true,
}),
*/
var UseLegacy = altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "use-legacy",
Usage: "Use legacy store",
Destination: &options.UseLegacy,
})
var Timeout = altsrc.NewDurationFlag(&cli.DurationFlag{
Name: "timeout",
Usage: "timeout for each individual store query request",
Destination: &options.QueryTimeout,
Value: 1 * time.Minute,
})
var LogLevel = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
Name: "log-level",
Aliases: []string{"l"},
Value: &cliutils.ChoiceValue{
Choices: []string{"DEBUG", "INFO", "WARN", "ERROR", "DPANIC", "PANIC", "FATAL"},
Value: &options.LogLevel,
},
Usage: "Define the logging level (allowed values: DEBUG, INFO, WARN, ERROR, DPANIC, PANIC, FATAL)",
})
var LogEncoding = cliutils.NewGenericFlagSingleValue(&cli.GenericFlag{
Name: "log-encoding",
Usage: "Define the encoding used for the logs (allowed values: console, nocolor, json)",
Value: &cliutils.ChoiceValue{
Choices: []string{"console", "nocolor", "json"},
Value: &options.LogEncoding,
},
})
var LogOutput = altsrc.NewStringFlag(&cli.StringFlag{
Name: "log-output",
Value: "file",
Usage: "specifies where logging output should be written (stdout, file, file:./filename.log)",
Destination: &options.LogOutput,
})