summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/degesch.c b/degesch.c
index caec35b..972eb3e 100644
--- a/degesch.c
+++ b/degesch.c
@@ -3245,16 +3245,6 @@ g_command_handlers[] =
"command" },
};
-static void
-show_command_help (struct app_context *ctx,
- const char *quote, struct command_handler *handler)
-{
- buffer_send_status (ctx, ctx->global_buffer, "%s%s: %s",
- quote, handler->name, handler->description);
- buffer_send_status (ctx, ctx->global_buffer, "%s Arguments: %s",
- quote, handler->usage);
-}
-
static bool
handle_command_help (struct app_context *ctx, char *arguments)
{
@@ -3263,18 +3253,28 @@ 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:");
for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++)
- show_command_help (ctx, " ", &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);
+ }
return true;
}
char *command = cut_word (&arguments);
for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++)
- if (!strcasecmp_ascii (command, g_command_handlers[i].name))
+ {
+ struct command_handler *handler = &g_command_handlers[i];
+ if (!strcasecmp_ascii (command, handler->name))
{
buffer_send_status (ctx, ctx->global_buffer, "%s", "");
- show_command_help (ctx, "", &g_command_handlers[i]);
+ buffer_send_status (ctx, ctx->global_buffer, "%s: %s",
+ handler->name, handler->description);
+ buffer_send_status (ctx, ctx->global_buffer, " Arguments: %s",
+ handler->usage);
return true;
}
+ }
buffer_send_error (ctx, ctx->global_buffer,
"%s: %s", "No such command", command);
return true;