lncli: change listinvoices reversed flag to paginate-forwards

This commit renames the `reversed` pagination flag to
`paginate-forwards`, which is off by default. In order to
access older invoices one can set the paginate-forwards flag,
which is more intuitive than setting the reversed flag to false.
This commit is contained in:
bitromortac 2020-02-06 08:03:28 +01:00
parent 38b521d87d
commit 926d4ba52e

@ -2819,10 +2819,10 @@ var listInvoicesCommand = cli.Command{
allowing users to query for specific invoices through their add_index. allowing users to query for specific invoices through their add_index.
This can be done by using either the first_index_offset or This can be done by using either the first_index_offset or
last_index_offset fields included in the response as the index_offset of last_index_offset fields included in the response as the index_offset of
the next request. The reversed flag is set by default in order to the next request. Backward pagination is enabled by default to receive
paginate backwards. If you wish to paginate forwards, you must current invoices first. If you wish to paginate forwards, set the
explicitly set the flag to false. If none of the parameters are paginate-forwards flag. If none of the parameters are specified, then
specified, then the last 100 invoices will be returned. the last 100 invoices will be returned.
For example: if you have 200 invoices, "lncli listinvoices" will return For example: if you have 200 invoices, "lncli listinvoices" will return
the last 100 created. If you wish to retrieve the previous 100, the the last 100 created. If you wish to retrieve the previous 100, the
@ -2845,11 +2845,10 @@ var listInvoicesCommand = cli.Command{
Name: "max_invoices", Name: "max_invoices",
Usage: "the max number of invoices to return", Usage: "the max number of invoices to return",
}, },
cli.BoolTFlag{ cli.BoolFlag{
Name: "reversed", Name: "paginate-forwards",
Usage: "if set, the invoices returned precede the " + Usage: "if set, invoices succeeding the " +
"given index_offset, allowing backwards " + "index_offset will be returned",
"pagination",
}, },
}, },
Action: actionDecorator(listInvoices), Action: actionDecorator(listInvoices),
@ -2863,7 +2862,7 @@ func listInvoices(ctx *cli.Context) error {
PendingOnly: ctx.Bool("pending_only"), PendingOnly: ctx.Bool("pending_only"),
IndexOffset: ctx.Uint64("index_offset"), IndexOffset: ctx.Uint64("index_offset"),
NumMaxInvoices: ctx.Uint64("max_invoices"), NumMaxInvoices: ctx.Uint64("max_invoices"),
Reversed: ctx.Bool("reversed"), Reversed: !ctx.Bool("paginate-forwards"),
} }
invoices, err := client.ListInvoices(context.Background(), req) invoices, err := client.ListInvoices(context.Background(), req)