Skip to content

Commit

Permalink
lightning-cli: clean up human_help() function.
Browse files Browse the repository at this point in the history
Final arg is always 'false'.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jul 28, 2019
1 parent 7e97119 commit 7b1088a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cli/lightning-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ static int compare_help(const jsmntok_t *const *a,
buffer);
}

static void human_help(char *buffer, const jsmntok_t *result, bool has_command) {
static void human_help(char *buffer, const jsmntok_t *result)
{
unsigned int i;
/* `curr` is used as a temporary token */
const jsmntok_t *curr;
Expand Down Expand Up @@ -182,8 +183,7 @@ static void human_help(char *buffer, const jsmntok_t *result, bool has_command)
category = json_get_member(buffer, help[i], "category");
if (category && !json_tok_streq(buffer, category, prev_cat)) {
prev_cat = json_strdup(help, buffer, category);
if (!has_command)
printf("=== %s ===\n\n", prev_cat);
printf("=== %s ===\n\n", prev_cat);
}

command = json_get_member(buffer, help[i], "command");
Expand All @@ -195,8 +195,7 @@ static void human_help(char *buffer, const jsmntok_t *result, bool has_command)
}
tal_free(help);

if (!has_command)
printf("---\nrun `lightning-cli help <command>` for more information on a specific command\n");
printf("---\nrun `lightning-cli help <command>` for more information on a specific command\n");
}

enum format {
Expand Down Expand Up @@ -595,7 +594,7 @@ int main(int argc, char *argv[])
// if we have specific help command
if (format == HUMAN)
if (streq(method, "help") && command == NULL)
human_help(resp, result, false);
human_help(resp, result);
else
human_readable(resp, result, '\n');
else if (format == RAW)
Expand Down

0 comments on commit 7b1088a

Please sign in to comment.