degesch: make "/help /command" work
Works for aliases as well. Resolves a TODO entry.
This commit is contained in:
parent
61c52d793c
commit
7f28dcd1ef
2
NEWS
2
NEWS
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
* degesch: /set +=/-= now treats its argument as a string array
|
* degesch: /set +=/-= now treats its argument as a string array
|
||||||
|
|
||||||
|
* degesch: made "/help /command" work the same way as "/help command" does
|
||||||
|
|
||||||
* censor.lua: now stripping colours from censored messages;
|
* censor.lua: now stripping colours from censored messages;
|
||||||
their attributes are also configurable rather than always black on black
|
their attributes are also configurable rather than always black on black
|
||||||
|
|
||||||
|
|
|
@ -12188,8 +12188,9 @@ handle_command_help (struct handler_args *a)
|
||||||
if (!*a->arguments)
|
if (!*a->arguments)
|
||||||
return show_command_list (ctx);
|
return show_command_list (ctx);
|
||||||
|
|
||||||
// TODO: we should probably also accept commands names with a leading slash
|
const char *word = cut_word (&a->arguments);
|
||||||
char *command = cut_word (&a->arguments);
|
|
||||||
|
const char *command = word + (*word == '/');
|
||||||
for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++)
|
for (size_t i = 0; i < N_ELEMENTS (g_command_handlers); i++)
|
||||||
{
|
{
|
||||||
struct command_handler *handler = &g_command_handlers[i];
|
struct command_handler *handler = &g_command_handlers[i];
|
||||||
|
@ -12197,13 +12198,13 @@ handle_command_help (struct handler_args *a)
|
||||||
return show_command_help (ctx, handler);
|
return show_command_help (ctx, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (try_handle_command_help_option (ctx, command))
|
if (try_handle_command_help_option (ctx, word))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (str_map_find (get_aliases_config (ctx), command))
|
if (str_map_find (get_aliases_config (ctx), command))
|
||||||
log_global_status (ctx, "/#s is an alias", command);
|
log_global_status (ctx, "/#s is an alias", command);
|
||||||
else
|
else
|
||||||
log_global_error (ctx, "#s: #s", "No such command or option", command);
|
log_global_error (ctx, "#s: #s", "No such command or option", word);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue