From 03399648d5addf51cb0826561237e8f05c96734a Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Fri, 10 Aug 2018 19:38:01 -0700 Subject: [PATCH] cmd/lncli: add pagination flags for listinvoices command Co-authored-by: Andrey Savitskiy Co-authored-by: Valentine Wallace --- cmd/lncli/commands.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 7956af5e..8d852ed8 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -2312,8 +2312,16 @@ var listInvoicesCommand = cli.Command{ Flags: []cli.Flag{ cli.BoolFlag{ Name: "pending_only", - Usage: "toggles if all invoices should be returned, or only " + - "those that are currently unsettled", + Usage: "toggles if all invoices should be returned, " + + "or only those that are currently unsettled", + }, + cli.Uint64Flag{ + Name: "index_offset", + Usage: "the number of invoices to skip", + }, + cli.Uint64Flag{ + Name: "max_invoices", + Usage: "the max number of invoices to return", }, }, Action: actionDecorator(listInvoices), @@ -2323,13 +2331,10 @@ func listInvoices(ctx *cli.Context) error { client, cleanUp := getClient(ctx) defer cleanUp() - pendingOnly := true - if !ctx.Bool("pending_only") { - pendingOnly = false - } - req := &lnrpc.ListInvoiceRequest{ - PendingOnly: pendingOnly, + PendingOnly: ctx.Bool("pending_only"), + IndexOffset: uint32(ctx.Uint64("index_offset")), + NumMaxInvoices: uint32(ctx.Uint64("max_invoices")), } invoices, err := client.ListInvoices(context.Background(), req)