degesch: show help for program options
This commit is contained in:
parent
bef6b42d9e
commit
f308b3fb5d
31
degesch.c
31
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user