Skip to content

Commit

Permalink
rpc: Removing description from json_command struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahanaFarooqui committed Jul 26, 2024
1 parent 8b882ef commit 72c4775
Show file tree
Hide file tree
Showing 42 changed files with 126 additions and 320 deletions.
19 changes: 3 additions & 16 deletions cli/lightning-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,9 @@ static void human_help(char *buffer, const jsmntok_t *result)
unsigned int i;
/* `curr` is used as a temporary token */
const jsmntok_t *curr;
const char *prev_cat;
/* Contains all commands objects, which have the following structure :
* {
* "command": "The command name and usage",
* "description": "The command's description"
* "command": "The command name and usage"
* }
*/
const jsmntok_t * help_array = json_get_member(buffer, result, "help");
Expand All @@ -196,22 +194,11 @@ static void human_help(char *buffer, const jsmntok_t *result)

asort(help, tal_count(help), compare_help, buffer);

prev_cat = "";
for (i = 0; i < tal_count(help); i++) {
const jsmntok_t *category, *command, *desc;

category = json_get_member(buffer, help[i], "category");
if (category && !json_tok_streq(buffer, category, prev_cat)) {
prev_cat = json_strdup(help, buffer, category);
printf("=== %s ===\n\n", prev_cat);
}

const jsmntok_t *command;
command = json_get_member(buffer, help[i], "command");
desc = json_get_member(buffer, help[i], "description");
printf("%.*s\n",
printf("%.*s\n\n",
command->end - command->start, buffer + command->start);
printf(" %.*s\n\n",
desc->end - desc->start, buffer + desc->start);
}
tal_free(help);

Expand Down
1 change: 0 additions & 1 deletion cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12567,21 +12567,14 @@
"type": "object",
"additionalProperties": true,
"required": [
"command",
"description"
"command"
],
"properties": {
"command": {
"type": "string",
"description": [
"The command."
]
},
"description": {
"type": "string",
"description": [
"A one-line description of the purpose of this command."
]
}
}
}
Expand Down Expand Up @@ -12621,8 +12614,7 @@
"response": {
"help": [
{
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]",
"description": "Send payment specified by {bolt11}"
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]"
}
],
"format-hint": "simple"
Expand All @@ -12639,8 +12631,7 @@
"response": {
"help": [
{
"command": "dev subcommand=crash|rhash|slowcmd",
"description": "Developer command test multiplexer"
"command": "dev subcommand=crash|rhash|slowcmd"
}
],
"format-hint": "simple"
Expand Down
216 changes: 108 additions & 108 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -2618,7 +2618,6 @@ def stop2py(m):
def help_help2py(m):
return remove_default({
"command": m.command, # PrimitiveField in generate_composite
"description": m.description, # PrimitiveField in generate_composite
})


Expand Down
15 changes: 3 additions & 12 deletions doc/schemas/lightning-help.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,14 @@
"type": "object",
"additionalProperties": true,
"required": [
"command",
"description"
"command"
],
"properties": {
"command": {
"type": "string",
"description": [
"The command."
]
},
"description": {
"type": "string",
"description": [
"A one-line description of the purpose of this command."
]
}
}
}
Expand Down Expand Up @@ -85,8 +78,7 @@
"response": {
"help": [
{
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]",
"description": "Send payment specified by {bolt11}"
"command": "pay bolt11 [amount_msat] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] [localinvreqid] [exclude] [maxfee] [description] [dev_use_shadow]"
}
],
"format-hint": "simple"
Expand All @@ -103,8 +95,7 @@
"response": {
"help": [
{
"command": "dev subcommand=crash|rhash|slowcmd",
"description": "Developer command test multiplexer"
"command": "dev subcommand=crash|rhash|slowcmd"
}
],
"format-hint": "simple"
Expand Down
2 changes: 0 additions & 2 deletions lightningd/chaintopology.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@ static struct command_result *json_feerates(struct command *cmd,
static const struct json_command feerates_command = {
"feerates",
json_feerates,
"Return feerate estimates, either satoshi-per-kw ({style} perkw) or satoshi-per-kb ({style} perkb)."
};
AUTODATA(json_command, &feerates_command);

Expand All @@ -782,7 +781,6 @@ static struct command_result *json_parse_feerate(struct command *cmd,
static const struct json_command parse_feerate_command = {
"parsefeerate",
json_parse_feerate,
"Return current feerate in perkw + perkb for given feerate string."
};
AUTODATA(json_command, &parse_feerate_command);

Expand Down
11 changes: 0 additions & 11 deletions lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -2199,27 +2199,18 @@ static struct command_result *json_splice_signed(struct command *cmd,
static const struct json_command splice_init_command = {
"splice_init",
json_splice_init,
"Init a channel splice to {channel_id} for {relative_amount} satoshis with {initialpsbt}. "
"Returns updated {psbt} with (partial) contributions from peer"
};
AUTODATA(json_command, &splice_init_command);

static const struct json_command splice_update_command = {
"splice_update",
json_splice_update,
"Update {channel_id} currently active negotiated splice with {psbt}. "
""
"Returns updated {psbt} with (partial) contributions from peer. "
"If {commitments_secured} is true, next call may be to splicechannel_finalize, "
"otherwise keep calling splice_update passing back in the returned PSBT until "
"{commitments_secured} is true."
};
AUTODATA(json_command, &splice_update_command);

static const struct json_command splice_signed_command = {
"splice_signed",
json_splice_signed,
"Send our {signed_psbt}'s tx sigs for {channel_id}."
};
AUTODATA(json_command, &splice_signed_command);

Expand Down Expand Up @@ -2272,7 +2263,6 @@ static struct command_result *json_dev_feerate(struct command *cmd,
static const struct json_command dev_feerate_command = {
"dev-feerate",
json_dev_feerate,
"Set feerate for {id} to {feerate}",
.dev_only = true,
};
AUTODATA(json_command, &dev_feerate_command);
Expand Down Expand Up @@ -2328,7 +2318,6 @@ static struct command_result *json_dev_quiesce(struct command *cmd,
static const struct json_command dev_quiesce_command = {
"dev-quiesce",
json_dev_quiesce,
"Initiate quiscence protocol with peer",
.dev_only = true,
};
AUTODATA(json_command, &dev_quiesce_command);
1 change: 0 additions & 1 deletion lightningd/closed_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,5 @@ static struct command_result *json_listclosedchannels(struct command *cmd,
static const struct json_command listclosedchannels_command = {
"listclosedchannels",
json_listclosedchannels,
"Show historical (dead) channels."
};
AUTODATA(json_command, &listclosedchannels_command);
4 changes: 0 additions & 4 deletions lightningd/closing_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,9 +897,5 @@ discard_unopened: {
static const struct json_command close_command = {
"close",
json_close,
"Close the channel with {id} "
"(either peer ID, channel ID, or short channel ID). "
"Force a unilateral close after {unilateraltimeout} seconds (default 48h). "
"If {destination} address is provided, will be used as output address."
};
AUTODATA(json_command, &close_command);
2 changes: 0 additions & 2 deletions lightningd/configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ static struct command_result *json_listconfigs(struct command *cmd,
static const struct json_command listconfigs_command = {
"listconfigs",
json_listconfigs,
"List all configuration options, or with [config], just that one.",
};
AUTODATA(json_command, &listconfigs_command);

Expand Down Expand Up @@ -635,6 +634,5 @@ static struct command_result *json_setconfig(struct command *cmd,
static const struct json_command setconfig_command = {
"setconfig",
json_setconfig,
"Set a dynamically-adjustable config."
};
AUTODATA(json_command, &setconfig_command);
6 changes: 0 additions & 6 deletions lightningd/connect_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ static struct command_result *json_connect(struct command *cmd,
static const struct json_command connect_command = {
"connect",
json_connect,
"Connect to {id} at {host} (which can end in ':port' if not default). "
"{id} can also be of the form id@host"
};
AUTODATA(json_command, &connect_command);

Expand Down Expand Up @@ -915,7 +913,6 @@ static struct command_result *json_sendcustommsg(struct command *cmd,
static const struct json_command sendcustommsg_command = {
"sendcustommsg",
json_sendcustommsg,
"Send a custom message to the peer with the given {node_id}",
};

AUTODATA(json_command, &sendcustommsg_command);
Expand All @@ -937,7 +934,6 @@ static struct command_result *json_dev_suppress_gossip(struct command *cmd,
static const struct json_command dev_suppress_gossip = {
"dev-suppress-gossip",
json_dev_suppress_gossip,
"Stop this node from sending any more gossip.",
.dev_only = true,
};
AUTODATA(json_command, &dev_suppress_gossip);
Expand All @@ -959,7 +955,6 @@ static struct command_result *json_dev_report_fds(struct command *cmd,
static const struct json_command dev_report_fds = {
"dev-report-fds",
json_dev_report_fds,
"Ask connectd to report status of all its open files.",
.dev_only = true,
};
AUTODATA(json_command, &dev_report_fds);
Expand All @@ -981,7 +976,6 @@ static struct command_result *json_dev_connectd_exhaust_fds(struct command *cmd,
static const struct json_command dev_connectd_exhaust_fds = {
"dev-connectd-exhaust-fds",
json_dev_connectd_exhaust_fds,
"Make connectd run out of file descriptors",
.dev_only = true,
};
AUTODATA(json_command, &dev_connectd_exhaust_fds);
4 changes: 0 additions & 4 deletions lightningd/datastore.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,27 +346,23 @@ static struct command_result *json_datastoreusage(struct command *cmd,
static const struct json_command datastore_command = {
"datastore",
json_datastore,
"Add a {key} and {hex}/{string} data to the data store",
};
AUTODATA(json_command, &datastore_command);

static const struct json_command deldatastore_command = {
"deldatastore",
json_deldatastore,
"Remove a {key} from the data store",
};
AUTODATA(json_command, &deldatastore_command);

static const struct json_command listdatastore_command = {
"listdatastore",
json_listdatastore,
"List the datastore, optionally only {key}",
};
AUTODATA(json_command, &listdatastore_command);

static const struct json_command datastoreusage_command = {
"datastoreusage",
json_datastoreusage,
"List the datastore usage, starting from an optional {key}",
};
AUTODATA(json_command, &datastoreusage_command);
10 changes: 0 additions & 10 deletions lightningd/dual_open_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -3893,8 +3893,6 @@ static struct command_result *json_queryrates(struct command *cmd,
static const struct json_command queryrates_command = {
"dev-queryrates",
json_queryrates,
"Ask a peer what their contribution and liquidity rates are"
" for the given {amount} and {requested_amt}",
.dev_only = true,
};

Expand All @@ -3903,34 +3901,26 @@ AUTODATA(json_command, &queryrates_command);
static const struct json_command openchannel_init_command = {
"openchannel_init",
json_openchannel_init,
"Init an open channel to {id} with {initialpsbt} for {amount} satoshis. "
"Returns updated {psbt} with (partial) contributions from peer"
};

static const struct json_command openchannel_update_command = {
"openchannel_update",
json_openchannel_update,
"Update {channel_id} with {psbt}. "
"Returns updated {psbt} with (partial) contributions from peer. "
"If {commitments_secured} is true, next call should be to openchannel_signed"
};

static const struct json_command openchannel_signed_command = {
"openchannel_signed",
json_openchannel_signed,
"Send our {signed_psbt}'s tx sigs for {channel_id}."
};

static const struct json_command openchannel_bump_command = {
"openchannel_bump",
json_openchannel_bump,
"Attempt to bump the fee on {channel_id}'s funding transaction."
};

static const struct json_command openchannel_abort_command = {
"openchannel_abort",
json_openchannel_abort,
"Abort {channel_id}'s open. Usable while `commitment_signed=false`."
};

AUTODATA(json_command, &openchannel_init_command);
Expand Down
2 changes: 0 additions & 2 deletions lightningd/forwards.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ static struct command_result *json_listforwards(struct command *cmd,
static const struct json_command listforwards_command = {
"listforwards",
json_listforwards,
"List all forwarded payments and their information optionally filtering by [status], [in_channel] and [out_channel]"
};
AUTODATA(json_command, &listforwards_command);

Expand Down Expand Up @@ -301,6 +300,5 @@ static struct command_result *json_delforward(struct command *cmd,
static const struct json_command delforward_command = {
"delforward",
json_delforward,
"Delete a forwarded payment by [in_channel], [in_htlc_id] and [status]"
};
AUTODATA(json_command, &delforward_command);
Loading

0 comments on commit 72c4775

Please sign in to comment.