-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.go
More file actions
120 lines (117 loc) · 2.88 KB
/
cli.go
File metadata and controls
120 lines (117 loc) · 2.88 KB
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
package main
import (
"github.com/urfave/cli/v2"
)
var getCommand = cli.Command{
Name: "get",
Aliases: []string{"g"},
Usage: "balance, status",
Subcommands: []*cli.Command{
{
Name: "balance",
Aliases: []string{"b"},
Usage: "Get lightning network daemon (lnd) total channels' balance.",
Category: "get",
Action: getBalance,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "all",
Usage: "list all channels",
Value: true,
},
&cli.BoolFlag{
Name: "active",
Usage: "only list channels which are currently active",
},
&cli.BoolFlag{
Name: "inactive",
Usage: "only list channels which are currently inactive",
},
&cli.BoolFlag{
Name: "public",
Usage: "only list channels which are currently public",
},
&cli.BoolFlag{
Name: "private",
Usage: "only list channels which are currently private",
},
},
},
{
Name: "status",
Aliases: []string{"s"},
Usage: "Get lightning network daemon (lnd) status.",
Category: "get",
Action: getStatus,
},
},
}
var listCommand = cli.Command{
Name: "list",
Aliases: []string{"l"},
Usage: "channels, contracts",
Subcommands: []*cli.Command{
{
Name: "channels",
Usage: "List all open channels.",
Category: "list",
Action: listChannels,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "active_only",
Usage: "only list channels which are currently active",
},
&cli.BoolFlag{
Name: "inactive_only",
Usage: "only list channels which are currently inactive",
},
&cli.BoolFlag{
Name: "public_only",
Usage: "only list channels which are currently public",
},
&cli.BoolFlag{
Name: "private_only",
Usage: "only list channels which are currently private",
},
&cli.StringFlag{
Name: "peer",
Usage: "(optional) only display channels for a peer " +
"with a 66-byte hex-encoded pubkey",
},
},
},
{
Name: "contracts",
Usage: "List all forwarded Hash Time-Locked Contracts.",
ArgsUsage: "start_time [end_time] [index_offset] [max_events]",
Category: "list",
Action: listContracts,
Flags: []cli.Flag{
&cli.Int64Flag{
Name: "start_time",
Usage: "the starting time for the query, expressed in " +
"seconds since the unix epoch",
},
&cli.Int64Flag{
Name: "end_time",
Usage: "the end time for the query, expressed in " +
"seconds since the unix epoch",
},
&cli.Int64Flag{
Name: "index_offset",
Usage: "the number of events to skip",
},
&cli.Int64Flag{
Name: "max_events",
Usage: "the max number of events to return",
DefaultText: "100",
},
&cli.StringFlag{
Name: "channel",
Usage: "(optional) only display contracts for a channel " +
"with id in bbbbbb:iiii:p format",
},
},
},
},
}