qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Collin Walling <walling@linux.ibm.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command
Date: Thu, 19 Jul 2018 16:34:51 -0400	[thread overview]
Message-ID: <97bef638-4441-3367-6c64-9339cba3c33f@linux.ibm.com> (raw)
In-Reply-To: <20180719191818.GD2462@work-vm>

On 07/19/2018 03:18 PM, Dr. David Alan Gilbert wrote:
> * Collin Walling (walling@linux.ibm.com) 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 <stzi@linux.ibm.com>
>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>> ---
>>  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 / dgilbert@redhat.com / Manchester, UK
> 


-- 
Respectfully,
- Collin Walling

  reply	other threads:[~2018-07-19 20:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 15:03 [Qemu-devel] [PATCH] monitor: print message when using 'help' with an unknown command Collin Walling
2018-07-19 16:31 ` Markus Armbruster
2018-07-19 16:39   ` Collin Walling
2018-07-20 16:40     ` Eric Blake
2018-07-20 19:37       ` Collin Walling
2018-07-19 19:11   ` Dr. David Alan Gilbert
2018-07-19 19:18 ` Dr. David Alan Gilbert
2018-07-19 20:34   ` Collin Walling [this message]
2018-07-20 18:44     ` Dr. David Alan Gilbert

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=97bef638-4441-3367-6c64-9339cba3c33f@linux.ibm.com \
    --to=walling@linux.ibm.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).