summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/degesch.c b/degesch.c
index ebc24c0..451d429 100644
--- a/degesch.c
+++ b/degesch.c
@@ -3886,9 +3886,9 @@ static struct command_handler
g_command_handlers[] =
{
{ "help", handle_command_help, "Show help",
- "[command]" },
+ "[<command> | <option>]" },
{ "quit", handle_command_quit, "Quit the program",
- "[message]" },
+ "[<message>]" },
{ "buffer", handle_command_buffer, "Manage buffers",
"list | clear | move | { close [<number> | <name>] } | <number>" },
@@ -3964,8 +3964,33 @@ handle_command_help (struct app_context *ctx, char *arguments)
return true;
}
}
+
+ struct config_item_ *item =
+ config_item_get (ctx->config.root, command, NULL);
+ if (item)
+ {
+ struct config_schema *schema = item->schema;
+ buffer_send_status (ctx, ctx->global_buffer, "%s", "");
+ buffer_send_status (ctx, ctx->global_buffer,
+ "Option \"%s\":", command);
+ buffer_send_status (ctx, ctx->global_buffer,
+ " Description: %s", schema->comment);
+ buffer_send_status (ctx, ctx->global_buffer,
+ " Type: %s", config_item_type_name (schema->type));
+ buffer_send_status (ctx, ctx->global_buffer,
+ " Default: %s", schema->default_ ? schema->default_ : "null");
+
+ struct str tmp;
+ str_init (&tmp);
+ config_item_write (item, false, &tmp);
+ buffer_send_status (ctx, ctx->global_buffer,
+ " Current value: %s", tmp.str);
+ str_free (&tmp);
+ return true;
+ }
+
buffer_send_error (ctx, ctx->global_buffer,
- "%s: %s", "No such command", command);
+ "%s: %s", "No such command or option", command);
return true;
}