Skip to content

Commit f256294

Browse files
committed
loop: add reservation cli commands
1 parent ee5eba3 commit f256294

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

cmd/loop/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func main() {
147147
monitorCommand, quoteCommand, listAuthCommand,
148148
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
149149
setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand,
150-
getInfoCommand,
150+
getInfoCommand, reservationsCommands,
151151
}
152152

153153
err := app.Run(os.Args)

cmd/loop/reservations.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package main
2+
3+
import (
4+
"context"
5+
6+
"github.com/lightninglabs/loop/looprpc"
7+
"github.com/urfave/cli"
8+
)
9+
10+
var reservationsCommands = cli.Command{
11+
12+
Name: "reservations",
13+
ShortName: "r",
14+
Usage: "manage reservations",
15+
Subcommands: []cli.Command{
16+
listReservationsCommand,
17+
},
18+
}
19+
20+
var (
21+
listReservationsCommand = cli.Command{
22+
Name: "list",
23+
Usage: "list all reservations",
24+
ArgsUsage: "",
25+
Description: `
26+
List all reservations.
27+
`,
28+
Action: listReservations,
29+
}
30+
)
31+
32+
func listReservations(ctx *cli.Context) error {
33+
client, cleanup, err := getClient(ctx)
34+
if err != nil {
35+
return err
36+
}
37+
defer cleanup()
38+
39+
resp, err := client.ListReservations(
40+
context.Background(), &looprpc.ListReservationsRequest{},
41+
)
42+
if err != nil {
43+
return err
44+
}
45+
46+
printRespJSON(resp)
47+
return nil
48+
}

0 commit comments

Comments
 (0)