On 02/20/2018 12:15 PM, Rob Landley wrote:
> A lot of commands take a list of possible inputs to one of their options, and
> there should be a way to query "what are the inputs". The way qemu does it is 
> to
> let you supply ? as the input (ala "qemu-system-i386 -M ?")
> 
> The problem is ? is a shell wildcard so you have to quote it. Otherwise it 
> works
> _almost_ all the time, and then barfs if you have a single character filename 
> in
> your current directory because the shell swapped it out before running your 
> command.
> 
> Is there an obvious better api for this?
> 
> Advantages of the qemu approach are A) a certain number of people out there 
> are
> already familiar with this, B) if you see "ps -o ?" even once it's pretty easy
> to guess/remember what it does. Much more so than say "ps -o -". Disadvantage 
> is
> shell wildcard...
> 
> Hmmm...

Ah, qemu seems to have noticed the wildcard problem, and changed their
recommendation:

  $ qemu-system-i386 -M x
  qemu-system-i386: -M x: unsupported machine type
  Use -machine help to list supported machines

Ok, I suppose the magic name "help" is reasonable...?

(I could also output the list for any unknown type, but there should be an error
message at the top, and then it's not "for i in $(ps -o helo)"; do az $i; done"
scriptable.)

(One thing I've wondered about is where to _document_ this, and the error
message telling you how to get help is the obvious place...)

Rob
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to