qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with a


From: Collin Walling
Subject: Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
Date: Thu, 19 Jul 2018 16:34:51 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 07/19/2018 03:18 PM, Dr. David Alan Gilbert wrote:
> * Collin Walling (address@hidden) wrote:
>> When typing 'help' followed by an unknown command, QEMU will
>> not print anything to the command line to let the user know
>> they typed a bad command. Let's fix this by printing a message
>> to the monitor when this happens. For example:
>>
>>     (qemu) help xyz
>>     unknown command: 'xyz'
>>
>> Reported-by: Stefan Zimmermann <address@hidden>
>> Signed-off-by: Collin Walling <address@hidden>
>> ---
>>  monitor.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/monitor.c b/monitor.c
>> index 7af1f18..7942f9f 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -1034,9 +1034,12 @@ static void help_cmd_dump(Monitor *mon, const 
>> mon_cmd_t *cmds,
>>              } else {
>>                  help_cmd_dump_one(mon, cmd, args, arg_index);
>>              }
>> -            break;
>> +            return;
>>          }
>>      }
>> +
>> +    /* Entry not found */
>> +    monitor_printf(mon, "unknown command: '%s'\n", args[arg_index]);
> 
> Thanks, that does suffer from a similar bug to the one you fixed a
> few months back in  317c52cc6aa0d ('monitor: report entirety of hmp
> command on error'):
> 
> (qemu) help foo
> unknown command: 'foo'
> (qemu) help info foo
> unknown command: 'foo'

Yeah... my thinking was that "info" is a correct command, so let's instead only
report to the user just the piece that was incorrect.

If it makes better sense to include the whole "info foo" piece, it's certainly
doable... whichever makes the most sense. Thoughts?

> 
> Dave
> (And yes, please cc me, otherwise I can miss them)
> 

Will do :)

>>  }
>>  
>>  static void help_cmd(Monitor *mon, const char *name)
>> -- 
>> 2.7.4
>>
>>
> --
> Dr. David Alan Gilbert / address@hidden / Manchester, UK
> 


-- 
Respectfully,
- Collin Walling




reply via email to

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