@@ -17,60 +17,85 @@ var autopilotCommands = cli.Command{
1717 Usage : "manage autopilot sessions" ,
1818 Category : "Autopilot" ,
1919 Subcommands : []cli.Command {
20- {
21- Name : "features" ,
22- ShortName : "f" ,
23- Usage : "List available features" ,
24- Action : listFeatures ,
20+ listAutopilotFeaturesCmd ,
21+ addAutopilotSessionCmd ,
22+ revokeAutopilotSessionCmd ,
23+ listAutopilotSessionsCmd ,
24+ },
25+ }
26+
27+ var listAutopilotFeaturesCmd = cli.Command {
28+ Name : "features" ,
29+ ShortName : "f" ,
30+ Usage : "List available Autopilot features." ,
31+ Description : `
32+ List available Autopilot features.
33+ ` ,
34+ Action : listFeatures ,
35+ }
36+
37+ var addAutopilotSessionCmd = cli.Command {
38+ Name : "add" ,
39+ ShortName : "a" ,
40+ Usage : "Initialize an Autopilot session." ,
41+ Description : `
42+ Initialize an Autopilot session.
43+ ` ,
44+ Action : initAutopilotSession ,
45+ Flags : []cli.Flag {
46+ labelFlag ,
47+ expiryFlag ,
48+ mailboxServerAddrFlag ,
49+ devserver ,
50+ cli.StringSliceFlag {
51+ Name : "feature" ,
52+ Required : true ,
2553 },
26- {
27- Name : "add" ,
28- ShortName : "a" ,
29- Usage : "Initialize an autopilot session" ,
30- Action : initAutopilotSession ,
31- Flags : []cli.Flag {
32- labelFlag ,
33- expiryFlag ,
34- mailboxServerAddrFlag ,
35- devserver ,
36- cli.StringSliceFlag {
37- Name : "feature" ,
38- Required : true ,
39- },
40- cli.StringFlag {
41- Name : "channel-restrict-list" ,
42- Usage : "list of channel IDs that the " +
43- "autopilot server should not " +
44- "perform actions on. In the " +
45- "form of: chanID1,chanID2,..." ,
46- },
47- cli.StringFlag {
48- Name : "peer-restrict-list" ,
49- Usage : "list of peer IDs that the " +
50- "autopilot server should not " +
51- "perform actions on. In the " +
52- "form of: peerID1,peerID2,..." ,
53- },
54- },
54+ cli.StringFlag {
55+ Name : "channel-restrict-list" ,
56+ Usage : "list of channel IDs that the " +
57+ "Autopilot server should not " +
58+ "perform actions on. In the " +
59+ "form of: chanID1,chanID2,..." ,
5560 },
56- {
57- Name : "revoke" ,
58- ShortName : "r" ,
59- Usage : "revoke an autopilot session" ,
60- Description : "Revoke an active autopilot session" ,
61- Action : revokeAutopilotSession ,
62- Flags : []cli.Flag {
63- cli.StringFlag {
64- Name : "localpubkey" ,
65- Usage : "local pubkey of the " +
66- "session to revoke" ,
67- Required : true ,
68- },
69- },
61+ cli.StringFlag {
62+ Name : "peer-restrict-list" ,
63+ Usage : "list of peer IDs that the " +
64+ "Autopilot server should not " +
65+ "perform actions on. In the " +
66+ "form of: peerID1,peerID2,..." ,
7067 },
7168 },
7269}
7370
71+ var revokeAutopilotSessionCmd = cli.Command {
72+ Name : "revoke" ,
73+ ShortName : "r" ,
74+ Usage : "Revoke an Autopilot session." ,
75+ Description : `
76+ Revoke an active Autopilot session.
77+ ` ,
78+ Action : revokeAutopilotSession ,
79+ Flags : []cli.Flag {
80+ cli.StringFlag {
81+ Name : "localpubkey" ,
82+ Usage : "local pubkey of the " +
83+ "session to revoke" ,
84+ Required : true ,
85+ },
86+ },
87+ }
88+
89+ var listAutopilotSessionsCmd = cli.Command {
90+ Name : "list" ,
91+ ShortName : "l" ,
92+ Usage : "List all Autopilot sessions." ,
93+ Description : `
94+ List all Autopilot sessions.
95+ ` ,
96+ Action : listAutopilotSessions ,
97+ }
98+
7499func revokeAutopilotSession (ctx * cli.Context ) error {
75100 ctxb := context .Background ()
76101 clientConn , cleanup , err := connectClient (ctx )
@@ -99,6 +124,27 @@ func revokeAutopilotSession(ctx *cli.Context) error {
99124 return nil
100125}
101126
127+ func listAutopilotSessions (ctx * cli.Context ) error {
128+ ctxb := context .Background ()
129+ clientConn , cleanup , err := connectClient (ctx )
130+ if err != nil {
131+ return err
132+ }
133+ defer cleanup ()
134+ client := litrpc .NewAutopilotClient (clientConn )
135+
136+ resp , err := client .ListAutopilotSessions (
137+ ctxb , & litrpc.ListAutopilotSessionsRequest {},
138+ )
139+ if err != nil {
140+ return err
141+ }
142+
143+ printRespJSON (resp )
144+
145+ return nil
146+ }
147+
102148func listFeatures (ctx * cli.Context ) error {
103149 ctxb := context .Background ()
104150 clientConn , cleanup , err := connectClient (ctx )
0 commit comments