diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-05-09 23:08:30 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-05-09 23:08:30 +0200 |
commit | 5b9e263ca7de0de470ebd1f0ccb7c8b05da788d7 (patch) | |
tree | 34e829cfb28b4e868c926f984e85c498d57966a0 /degesch.c | |
parent | 789db85915baf79c2ade61aecede8c365103f363 (diff) | |
download | xK-5b9e263ca7de0de470ebd1f0ccb7c8b05da788d7.tar.gz xK-5b9e263ca7de0de470ebd1f0ccb7c8b05da788d7.tar.xz xK-5b9e263ca7de0de470ebd1f0ccb7c8b05da788d7.zip |
degesch: improve /help display
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -4944,11 +4944,18 @@ handle_command_help (struct app_context *ctx, char *arguments) { buffer_send_status (ctx, ctx->global_buffer, "%s", ""); buffer_send_status (ctx, ctx->global_buffer, "Commands:"); + + int longest = 0; + for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++) + { + int len = strlen (g_command_handlers[i].name); + longest = MAX (longest, len); + } for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++) { struct command_handler *handler = &g_command_handlers[i]; - buffer_send_status (ctx, ctx->global_buffer, " %s: %s", - handler->name, handler->description); + buffer_send_status (ctx, ctx->global_buffer, " %-*s %s", + longest, handler->name, handler->description); } return true; } |