+2012-11-20 Mike Frysinger <vapier@gentoo.org>
+
+ * cli/cli-decode.c (complete_on_cmdlist): Add a fourth arg and check
+ it when looking at ptr->func.
+ * command.h (complete_on_cmdlist): Add a fourth arg.
+ * completer.c (complete_line_internal): Add local ignore_help_classes,
+ and set it to 1 when reason is not handle_help. Pass this down to
+ lookup_cmd_1 and complete_on_cmdlist.
+
2012-11-20 Tom Tromey <tromey@redhat.com>
* completer.c (count_struct_fields): Remove.
"oobar"; if WORD is "baz/foo", return "baz/foobar". */
VEC (char_ptr) *
-complete_on_cmdlist (struct cmd_list_element *list, char *text, char *word)
+complete_on_cmdlist (struct cmd_list_element *list, char *text, char *word,
+ int ignore_help_classes)
{
struct cmd_list_element *ptr;
VEC (char_ptr) *matchlist = NULL;
for (ptr = list; ptr; ptr = ptr->next)
if (!strncmp (ptr->name, text, textlen)
&& !ptr->abbrev_flag
- && (ptr->func
+ && (!ignore_help_classes || ptr->func
|| ptr->prefixlist))
{
char *match;
{
VEC (char_ptr) *list = NULL;
char *tmp_command, *p;
+ int ignore_help_classes;
/* Pointer within tmp_command which corresponds to text. */
char *word;
struct cmd_list_element *c, *result_list;
tmp_command = (char *) alloca (point + 1);
p = tmp_command;
+ /* The help command should complete help aliases. */
+ ignore_help_classes = reason != handle_help;
+
strncpy (tmp_command, line_buffer, point);
tmp_command[point] = '\0';
/* Since text always contains some number of characters leading up
}
else
{
- c = lookup_cmd_1 (&p, cmdlist, &result_list, 1);
+ c = lookup_cmd_1 (&p, cmdlist, &result_list, ignore_help_classes);
}
/* Move p up to the next interesting thing. */
{
if (reason != handle_brkchars)
list = complete_on_cmdlist (*result_list->prefixlist, p,
- word);
+ word, ignore_help_classes);
}
else
{
if (reason != handle_brkchars)
- list = complete_on_cmdlist (cmdlist, p, word);
+ list = complete_on_cmdlist (cmdlist, p, word,
+ ignore_help_classes);
}
/* Ensure that readline does the right thing with respect to
inserting quotes. */
/* It is a prefix command; what comes after it is
a subcommand (e.g. "info "). */
if (reason != handle_brkchars)
- list = complete_on_cmdlist (*c->prefixlist, p, word);
+ list = complete_on_cmdlist (*c->prefixlist, p, word,
+ ignore_help_classes);
/* Ensure that readline does the right thing
with respect to inserting quotes. */
}
if (reason != handle_brkchars)
- list = complete_on_cmdlist (result_list, q, word);
+ list = complete_on_cmdlist (result_list, q, word,
+ ignore_help_classes);
/* Ensure that readline does the right thing
with respect to inserting quotes. */