Skip to content

Commit 90d9502

Browse files
cli: improve help output formatting.
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]>
1 parent 6f4a2ae commit 90d9502

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cli/lightning-cli.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ static size_t human_readable(const char *buffer, const jsmntok_t *t, char term)
4949
i++;
5050
continue;
5151
}
52+
} else if (buffer[i] == '|') {
53+
fputc('\n', stdout);
54+
i++;
55+
continue;
5256
}
5357
fputc(buffer[i], stdout);
5458
}
@@ -197,8 +201,8 @@ static void human_help(char *buffer, const jsmntok_t *result)
197201
for (i = 0; i < tal_count(help); i++) {
198202
const jsmntok_t *command;
199203
command = json_get_member(buffer, help[i], "command");
200-
printf("%.*s\n\n",
201-
command->end - command->start, buffer + command->start);
204+
human_readable(buffer, command, '\n');
205+
printf("\n");
202206
}
203207
tal_free(help);
204208

0 commit comments

Comments
 (0)