Skip to content

Commit 15a3920

Browse files
committed
cmd/litcli: commands for status server
1 parent c31c3c2 commit 15a3920

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

cmd/litcli/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func main() {
7272
}
7373
app.Commands = append(app.Commands, sessionCommands...)
7474
app.Commands = append(app.Commands, accountsCommands...)
75+
app.Commands = append(app.Commands, statusCommands...)
7576

7677
err := app.Run(os.Args)
7778
if err != nil {

cmd/litcli/status.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package main
2+
3+
import (
4+
"context"
5+
6+
"github.com/lightninglabs/lightning-terminal/litrpc"
7+
"github.com/urfave/cli"
8+
)
9+
10+
var statusCommands = []cli.Command{
11+
{
12+
Name: "status",
13+
Usage: "info about litd status",
14+
Category: "Status",
15+
Action: getStatus,
16+
},
17+
}
18+
19+
func getStatus(ctx *cli.Context) error {
20+
clientConn, cleanup, err := connectClient(ctx)
21+
if err != nil {
22+
return err
23+
}
24+
defer cleanup()
25+
client := litrpc.NewStatusClient(clientConn)
26+
27+
ctxb := context.Background()
28+
resp, err := client.GetSubServerState(
29+
ctxb, &litrpc.GetSubServerStatusReq{},
30+
)
31+
if err != nil {
32+
return err
33+
}
34+
35+
printRespJSON(resp)
36+
37+
return nil
38+
}

0 commit comments

Comments
 (0)