qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/6] hmp: Restrict auto-complete in preconfig


From: Peter Xu
Subject: Re: [Qemu-devel] [PATCH 3/6] hmp: Restrict auto-complete in preconfig
Date: Thu, 7 Jun 2018 16:52:30 +0800
User-agent: Mutt/1.9.5 (2018-04-13)

On Tue, Jun 05, 2018 at 01:26:33PM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
> 
> Don't show the commands that aren't available.
> 
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> ---
>  monitor.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 7d1709c225..9b29787a52 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3950,12 +3950,17 @@ static void monitor_find_completion_by_table(Monitor 
> *mon,
>              cmdname = args[0];
>          readline_set_completion_index(mon->rs, strlen(cmdname));
>          for (cmd = cmd_table; cmd->name != NULL; cmd++) {
> -            cmd_completion(mon, cmdname, cmd->name);
> +            if (!runstate_check(RUN_STATE_PRECONFIG) ||
> +                 cmd_can_preconfig(cmd)) {
> +                cmd_completion(mon, cmdname, cmd->name);
> +            }
>          }
>      } else {
>          /* find the command */
>          for (cmd = cmd_table; cmd->name != NULL; cmd++) {
> -            if (compare_cmd(args[0], cmd->name)) {
> +            if (compare_cmd(args[0], cmd->name) &&
> +                (!runstate_check(RUN_STATE_PRECONFIG) ||
> +                 cmd_can_preconfig(cmd))) {

(so if there is a helper we can also use it here)

Reviewed-by: Peter Xu <address@hidden>

>                  break;
>              }
>          }
> -- 
> 2.17.0
> 
> 

-- 
Peter Xu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]