cmd/lncli: implementing parsing+display for list channels
This commit is contained in:
parent
7a6905d697
commit
301a9fea38
@ -509,6 +509,34 @@ func pendingChannels(ctx *cli.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ListChannelsCommand = cli.Command{
|
||||||
|
Name: "listchannels",
|
||||||
|
Description: "list all open channels",
|
||||||
|
Usage: "listchannels --active_only",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "active_only, a",
|
||||||
|
Usage: "only list channels which are currently active",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: listChannels,
|
||||||
|
}
|
||||||
|
|
||||||
|
func listChannels(ctx *cli.Context) error {
|
||||||
|
ctxb := context.Background()
|
||||||
|
client := getClient(ctx)
|
||||||
|
|
||||||
|
req := &lnrpc.ListChannelsRequest{}
|
||||||
|
resp, err := client.ListChannels(ctxb, req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
printRespJson(resp)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var SendPaymentCommand = cli.Command{
|
var SendPaymentCommand = cli.Command{
|
||||||
Name: "sendpayment",
|
Name: "sendpayment",
|
||||||
Description: "send a payment over lightning",
|
Description: "send a payment over lightning",
|
||||||
|
@ -65,6 +65,7 @@ func main() {
|
|||||||
LookupInvoiceCommand,
|
LookupInvoiceCommand,
|
||||||
ListInvoicesCommand,
|
ListInvoicesCommand,
|
||||||
ShowRoutingTableCommand,
|
ShowRoutingTableCommand,
|
||||||
|
ListChannelsCommand,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user