From: Luiz Capitulino <lcapitulino@redhat.com>
To: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] monitor: support sub commands in auto completion
Date: Fri, 21 Jun 2013 11:24:44 -0400 [thread overview]
Message-ID: <20130621112444.14891a5f@redhat.com> (raw)
In-Reply-To: <1371796658-15632-3-git-send-email-xiawenc@linux.vnet.ibm.com>
On Fri, 21 Jun 2013 14:37:38 +0800
Wenchao Xia <xiawenc@linux.vnet.ibm.com> wrote:
> This patch allow auot completion work normal in sub command case,
> "info block [DEVICE]" can auto complete now, by re-enter the completion
> function. Also, original "info" is treated as a special case, now it is
> treated as a sub command group, global variable info_cmds is not used
> any more.
>
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
> monitor.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index bc60171..c706644 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4180,6 +4180,11 @@ static void monitor_find_completion(Monitor *mon,
> goto cleanup;
> }
>
> + if (cmd->sub_table) {
> + return monitor_find_completion(mon, cmd->sub_table,
> + cmdline + strlen(cmd->name));
> + }
> +
> ptype = next_arg_type(cmd->args_type);
> for(i = 0; i < nb_args - 2; i++) {
> if (*ptype != '\0') {
> @@ -4207,12 +4212,7 @@ static void monitor_find_completion(Monitor *mon,
> break;
> case 's':
> /* XXX: more generic ? */
I think you can drop this comment too.
> - if (!strcmp(cmd->name, "info")) {
> - readline_set_completion_index(mon->rs, strlen(str));
> - for(cmd = info_cmds; cmd->name != NULL; cmd++) {
> - cmd_completion(mon, str, cmd->name);
> - }
> - } else if (!strcmp(cmd->name, "sendkey")) {
> + if (!strcmp(cmd->name, "sendkey")) {
> char *sep = strrchr(str, '-');
> if (sep)
> str = sep + 1;
prev parent reply other threads:[~2013-06-21 15:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-21 6:37 [Qemu-devel] [PATCH 0/2] support sub command group for auto completion in monitor Wenchao Xia
2013-06-21 6:37 ` [Qemu-devel] [PATCH 1/2] monitor: discard global variable in auto completion functions Wenchao Xia
2013-06-21 15:24 ` Luiz Capitulino
2013-06-24 5:36 ` Wenchao Xia
2013-06-21 6:37 ` [Qemu-devel] [PATCH 2/2] monitor: support sub commands in auto completion Wenchao Xia
2013-06-21 15:24 ` Luiz Capitulino [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130621112444.14891a5f@redhat.com \
--to=lcapitulino@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xiawenc@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.