Skip to content

Commit c39cd3c

Browse files
main: make cmd documentation coherent
1 parent d782cbb commit c39cd3c

File tree

9 files changed

+154
-153
lines changed

9 files changed

+154
-153
lines changed

cmd/litcli/accounts.go

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var accountsCommands = []cli.Command{
2222
{
2323
Name: "accounts",
2424
ShortName: "a",
25-
Usage: "manage accounts",
25+
Usage: "Manage accounts",
2626
Category: "Accounts",
2727
Subcommands: []cli.Command{
2828
createAccountCommand,
@@ -31,6 +31,7 @@ var accountsCommands = []cli.Command{
3131
accountInfoCommand,
3232
removeAccountCommand,
3333
},
34+
Description: "Manage accounts.",
3435
},
3536
}
3637

@@ -39,38 +40,38 @@ var createAccountCommand = cli.Command{
3940
ShortName: "c",
4041
Usage: "Create a new off-chain account with a balance.",
4142
ArgsUsage: "balance [expiration_date] [--label=LABEL] [--save_to=FILE]",
42-
Description: `
43-
Adds an entry to the account database. This entry represents an amount
44-
of satoshis (account balance) that can be spent using off-chain
45-
transactions (e.g. paying invoices).
46-
47-
Macaroons can be created to be locked to an account. This makes sure
48-
that the bearer of the macaroon can only spend at most that amount of
49-
satoshis through the daemon that has issued the macaroon.
50-
51-
Accounts only assert a maximum amount spendable. Having a certain
52-
account balance does not guarantee that the node has the channel
53-
liquidity to actually spend that amount.
54-
`,
43+
Description: "Adds an entry to the account database. " +
44+
"This entry represents an amount of satoshis (account " +
45+
"balance) that can be spent using off-chain transactions " +
46+
"(e.g. paying invoices).\n\n" +
47+
48+
" Macaroons can be created to be locked to an account. " +
49+
"This makes sure that the bearer of the macaroon can only " +
50+
"spend at most that amount of satoshis through the daemon " +
51+
"that has issued the macaroon.\n\n" +
52+
53+
" Accounts only assert a maximum amount spendable. Having " +
54+
"a certain account balance does not guarantee that the node " +
55+
"has the channel liquidity to actually spend that amount.",
5556
Flags: []cli.Flag{
5657
cli.Uint64Flag{
5758
Name: "balance",
58-
Usage: "the initial balance of the account",
59+
Usage: "The initial balance of the account.",
5960
},
6061
cli.Int64Flag{
6162
Name: "expiration_date",
62-
Usage: "the expiration date of the account expressed " +
63+
Usage: "The expiration date of the account expressed " +
6364
"in seconds since the unix epoch. 0 means " +
64-
"it does not expire",
65+
"it does not expire.",
6566
},
6667
cli.StringFlag{
6768
Name: "save_to",
68-
Usage: "store the account macaroon created for the " +
69-
"account to the given file",
69+
Usage: "Store the account macaroon created for the " +
70+
"account to the given file.",
7071
},
7172
cli.StringFlag{
7273
Name: labelName,
73-
Usage: "(optional) the unique label of the account",
74+
Usage: "(optional) The unique label of the account.",
7475
},
7576
},
7677
Action: createAccount,
@@ -152,31 +153,29 @@ var updateAccountCommand = cli.Command{
152153
ShortName: "u",
153154
Usage: "Update an existing off-chain account.",
154155
ArgsUsage: "[id | label] new_balance [new_expiration_date] [--save_to=]",
155-
Description: `
156-
Updates an existing off-chain account and sets either a new balance or
157-
new expiration date or both.
158-
`,
156+
Description: "Updates an existing off-chain account and sets " +
157+
"either a new balance or new expiration date or both.",
159158
Flags: []cli.Flag{
160159
cli.StringFlag{
161160
Name: idName,
162-
Usage: "the ID of the account to update",
161+
Usage: "The ID of the account to update.",
163162
},
164163
cli.StringFlag{
165164
Name: labelName,
166-
Usage: "(optional) the unique label of the account",
165+
Usage: "(optional) The unique label of the account.",
167166
},
168167
cli.Int64Flag{
169168
Name: "new_balance",
170-
Usage: "the new balance of the account; -1 means do " +
171-
"not update the balance",
169+
Usage: "The new balance of the account; -1 means do " +
170+
"not update the balance.",
172171
Value: -1,
173172
},
174173
cli.Int64Flag{
175174
Name: "new_expiration_date",
176-
Usage: "the new expiration date of the account " +
175+
Usage: "The new expiration date of the account " +
177176
"expressed in seconds since the unix epoch; " +
178177
"-1 means do not update the expiration date; " +
179-
"0 means it does not expire",
178+
"0 means it does not expire.",
180179
Value: -1,
181180
},
182181
},
@@ -243,11 +242,9 @@ func updateAccount(ctx *cli.Context) error {
243242
var listAccountsCommand = cli.Command{
244243
Name: "list",
245244
ShortName: "l",
246-
Usage: "Lists all off-chain accounts.",
247-
Description: `
248-
Returns all accounts that are currently stored in the account
249-
database.
250-
`,
245+
Usage: "List all off-chain accounts.",
246+
Description: "Returns all accounts that are currently stored in " +
247+
"the account database.",
251248
Action: listAccounts,
252249
}
253250

@@ -275,17 +272,16 @@ var accountInfoCommand = cli.Command{
275272
ShortName: "i",
276273
Usage: "Show information about a single off-chain account.",
277274
ArgsUsage: "[id | label]",
278-
Description: `
279-
Returns a single account entry from the account database.
280-
`,
275+
Description: "Returns a single account entry from the account " +
276+
"database.",
281277
Flags: []cli.Flag{
282278
cli.StringFlag{
283279
Name: idName,
284-
Usage: "the ID of the account",
280+
Usage: "The ID of the account.",
285281
},
286282
cli.StringFlag{
287283
Name: labelName,
288-
Usage: "(optional) the unique label of the account",
284+
Usage: "(optional) The unique label of the account.",
289285
},
290286
},
291287
Action: accountInfo,
@@ -321,19 +317,17 @@ func accountInfo(ctx *cli.Context) error {
321317
var removeAccountCommand = cli.Command{
322318
Name: "remove",
323319
ShortName: "r",
324-
Usage: "Removes an off-chain account from the database.",
320+
Usage: "Remove an off-chain account from the database.",
325321
ArgsUsage: "[id | label]",
326-
Description: `
327-
Removes an account entry from the account database.
328-
`,
322+
Description: "Removes an account entry from the account database.",
329323
Flags: []cli.Flag{
330324
cli.StringFlag{
331325
Name: idName,
332-
Usage: "the ID of the account",
326+
Usage: "The ID of the account.",
333327
},
334328
cli.StringFlag{
335329
Name: labelName,
336-
Usage: "(optional) the unique label of the account",
330+
Usage: "(optional) The unique label of the account.",
337331
},
338332
},
339333
Action: removeAccount,

cmd/litcli/actions.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
var listActionsCommand = cli.Command{
1313
Name: "actions",
1414
Usage: "List actions performed on the Litd server",
15+
Category: "Firewall",
1516
Action: listActions,
1617
Flags: []cli.Flag{
1718
cli.StringFlag{
@@ -53,22 +54,22 @@ var listActionsCommand = cli.Command{
5354
Name: "state",
5455
Usage: "The action state to filter on. If not set, " +
5556
"then actions of any state will be returned. " +
56-
"Options include: 'pending', 'done' and 'error",
57+
"Options include: 'pending', 'done' and 'error'.",
5758
},
5859
cli.Uint64Flag{
5960
Name: "index_offset",
6061
Usage: "The index of an action that will be used as " +
61-
"either the start a query to determine which " +
62-
"actions should be returned in the response",
62+
"the start of a query to determine which " +
63+
"actions should be returned in the response.",
6364
},
6465
cli.Uint64Flag{
6566
Name: "max_num_actions",
66-
Usage: "The max number of actions to return",
67+
Usage: "The max number of actions to return.",
6768
},
6869
cli.BoolFlag{
6970
Name: "oldest_first",
70-
Usage: "Tf set, actions succeeding the index_offset " +
71-
"will be returned",
71+
Usage: "If set, actions succeeding the index_offset " +
72+
"will be returned.",
7273
},
7374
cli.BoolFlag{
7475
Name: "count_total",

cmd/litcli/autopilot.go

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,33 @@ import (
1616

1717
var autopilotCommands = cli.Command{
1818
Name: "autopilot",
19-
Usage: "manage autopilot sessions",
20-
Category: "Autopilot",
19+
Usage: "Manage autopilot sessions",
20+
Category: "LNC",
2121
Subcommands: []cli.Command{
2222
listAutopilotFeaturesCmd,
2323
addAutopilotSessionCmd,
2424
revokeAutopilotSessionCmd,
2525
listAutopilotSessionsCmd,
2626
},
27+
Description: "Manage autopilot sessions.",
2728
}
2829

2930
var listAutopilotFeaturesCmd = cli.Command{
3031
Name: "features",
3132
ShortName: "f",
3233
Usage: "List available Autopilot features.",
33-
Description: `
34-
List available Autopilot features.
35-
`,
34+
Description: "List available Autopilot features.",
3635
Action: listFeatures,
3736
}
3837

3938
var addAutopilotSessionCmd = cli.Command{
4039
Name: "add",
4140
ShortName: "a",
4241
Usage: "Initialize an Autopilot session.",
43-
Description: `
44-
Initialize an Autopilot session.
45-
46-
If set for any feature, configuration flags need to be repeated for each
47-
feature that is registered, corresponding to the order of features.`,
42+
Description: "Initialize an Autopilot session.\n\n" +
43+
" If set for any feature, configuration flags need to be " +
44+
"repeated for each feature that is registered, corresponding " +
45+
"to the order of features.",
4846
Action: initAutopilotSession,
4947
Flags: []cli.Flag{
5048
labelFlag,
@@ -57,31 +55,31 @@ var addAutopilotSessionCmd = cli.Command{
5755
},
5856
cli.StringFlag{
5957
Name: "channel-restrict-list",
60-
Usage: "list of channel IDs that the " +
58+
Usage: "List of channel IDs that the " +
6159
"Autopilot server should not " +
6260
"perform actions on. In the " +
6361
"form of: chanID1,chanID2,...",
6462
},
6563
cli.StringFlag{
6664
Name: "peer-restrict-list",
67-
Usage: "list of peer IDs that the " +
65+
Usage: "List of peer IDs that the " +
6866
"Autopilot server should not " +
6967
"perform actions on. In the " +
7068
"form of: peerID1,peerID2,...",
7169
},
7270
cli.StringFlag{
7371
Name: "group_id",
7472
Usage: "The hex encoded group ID of the session " +
75-
"group to link this one to",
73+
"group to link this one to.",
7674
},
7775
cli.StringSliceFlag{
7876
Name: "feature-config",
79-
Usage: `JSON-serialized configuration with the ` +
80-
`expected format: {"version":0,` +
81-
`"option1":"parameter1",` +
82-
`"option2":"parameter2",...}. An empty ` +
83-
`configuration is allowed with {} to use the ` +
84-
`default configuration`,
77+
Usage: "JSON-serialized configuration with the " +
78+
"expected format: {\"version\":0," +
79+
"\"option1\":\"parameter1\"," +
80+
"\"option2\":\"parameter2\",...}. An empty " +
81+
"configuration is allowed with {} to use the " +
82+
"default configuration.",
8583
},
8684
},
8785
}
@@ -90,15 +88,13 @@ var revokeAutopilotSessionCmd = cli.Command{
9088
Name: "revoke",
9189
ShortName: "r",
9290
Usage: "Revoke an Autopilot session.",
93-
Description: `
94-
Revoke an active Autopilot session.
95-
`,
91+
Description: "Revoke an active Autopilot session.",
9692
Action: revokeAutopilotSession,
9793
Flags: []cli.Flag{
9894
cli.StringFlag{
9995
Name: "localpubkey",
100-
Usage: "local pubkey of the " +
101-
"session to revoke",
96+
Usage: "Local pubkey of the " +
97+
"session to revoke.",
10298
Required: true,
10399
},
104100
},
@@ -108,9 +104,7 @@ var listAutopilotSessionsCmd = cli.Command{
108104
Name: "list",
109105
ShortName: "l",
110106
Usage: "List all Autopilot sessions.",
111-
Description: `
112-
List all Autopilot sessions.
113-
`,
107+
Description: "List all Autopilot sessions.\n",
114108
Action: listAutopilotSessions,
115109
}
116110

cmd/litcli/helpers.go

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import (
1414
// helperCommands are commands that do not require a connection to LiTd to
1515
// return a response.
1616
var helperCommands = cli.Command{
17-
Name: "helper",
18-
Usage: "helper commands",
19-
Category: "Helper",
17+
Name: "helper",
18+
Usage: "Helper commands",
19+
Description: "Helper commands.",
20+
Category: "LiT",
2021
Subcommands: []cli.Command{
2122
generateSuperMacRootIDCmd,
2223
isSuperMacaroonCmd,
@@ -27,21 +28,20 @@ var helperCommands = cli.Command{
2728
// key ID for a super macaroon. A suffix may be specified.
2829
var generateSuperMacRootIDCmd = cli.Command{
2930
Name: "supermacrootkey",
30-
Usage: "Generate a valid super macaroon root key ID from scratch " +
31-
"or from a given root key ID suffix",
32-
Description: `
33-
This command can be used to generate a valid super macaroon root key ID
34-
from scratch or from a given root key ID suffix.
35-
`,
31+
Usage: "Generate a valid super macaroon root key ID from " +
32+
"scratch or from a given root key ID suffix.",
33+
Description: "This command can be used to generate a valid " +
34+
"super macaroon root key ID from scratch or from " +
35+
"a given root key ID suffix.",
3636
Action: superMacRootKey,
3737
Flags: []cli.Flag{
3838
cli.StringFlag{
3939
Name: "root_key_suffix",
4040
Usage: "A 4-byte suffix to use in the construction " +
4141
"of the root key ID. If not provided, then a " +
4242
"random one will be generated. This must be " +
43-
"specified as a hex string using a maximum of " +
44-
"8 characters.",
43+
"specified as a hex string using a maximum " +
44+
"of 8 characters.",
4545
},
4646
},
4747
}
@@ -81,16 +81,14 @@ func superMacRootKey(ctx *cli.Context) error {
8181
// a macaroon is a super macaroon.
8282
var isSuperMacaroonCmd = cli.Command{
8383
Name: "issupermacaroon",
84-
Usage: "Prints 'true' if the given macaroon is a super macaroon",
85-
Description: `
86-
This command can be used to verify if a macaroon is considered a
87-
super macaroon.
88-
`,
84+
Usage: "Prints 'true' if the given macaroon is a super macaroon.",
85+
Description: "This command can be used to verify if a macaroon is " +
86+
"considered a super macaroon.",
8987
Action: isSuperMacaroon,
9088
Flags: []cli.Flag{
9189
cli.StringFlag{
9290
Name: "mac",
93-
Usage: "The hex-encoded macaroon",
91+
Usage: "The hex-encoded macaroon.",
9492
Required: true,
9593
},
9694
},

0 commit comments

Comments
 (0)