Skip to content

Commit

Permalink
cli: improve help output formatting.
Browse files Browse the repository at this point in the history
Changelog-Changed: Updated the `lightning-cli help` output by
replacing '\n' with '|' as a line separator, enhancing
readability and consistency.

Signed-off-by: Nishant Bansal <[email protected]>
  • Loading branch information
NishantBansal2003 committed Jan 21, 2025
1 parent 6f4a2ae commit 90d9502
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cli/lightning-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ static size_t human_readable(const char *buffer, const jsmntok_t *t, char term)
i++;
continue;
}
} else if (buffer[i] == '|') {
fputc('\n', stdout);
i++;
continue;
}
fputc(buffer[i], stdout);
}
Expand Down Expand Up @@ -197,8 +201,8 @@ static void human_help(char *buffer, const jsmntok_t *result)
for (i = 0; i < tal_count(help); i++) {
const jsmntok_t *command;
command = json_get_member(buffer, help[i], "command");
printf("%.*s\n\n",
command->end - command->start, buffer + command->start);
human_readable(buffer, command, '\n');
printf("\n");
}
tal_free(help);

Expand Down

0 comments on commit 90d9502

Please sign in to comment.