cmd/lncli: implementing parsing+display for list channels

This commit is contained in:
Olaoluwa Osuntokun committed 2016-09-25 20:05:06 -07:00
1 parent 7a6905d697
commit 301a9fea38
2 files changed
+29

No files matched your search

+28
View File
@@ -509,6 +509,34 @@ func pendingChannels(ctx *cli.Context) error {
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{
Name: "sendpayment",
Description: "send a payment over lightning",
+1
View File
@@ -65,6 +65,7 @@ func main() {
LookupInvoiceCommand,
ListInvoicesCommand,
ShowRoutingTableCommand,
ListChannelsCommand,
}
if err := app.Run(os.Args); err != nil {