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

Re: [libvirt] [RFC PATCH] virsh: new echo command



On Tue, Oct 12, 2010 at 05:39:24PM -0600, Eric Blake wrote:
> * tools/virsh.c (cmdEcho): New command.
> (commands): Add it.
> (vshCmdOptType): Add VSH_OT_ARGV.
> (vshCmddefGetData): Special case new opt flag.
> (vshCommandOptArgv): New function.
> ---
> 
> Not complete yet, but this shows what I'm thinking of.  Adding the
> echo command has two benefits:
> 
> 1. It will let me add unit tests for the recent virsh command line
> improvements - echo back arbitrary strings to make sure quoting is as
> desired.  This part works with what I have here, before I ran out of
> time to finish this today.
> 
> 2. Make it easier for a user on the command line to conver an
> arbitrary string into something safe for shell evalution and/or XML
> usage, by munging the input in a way that it can be reused in the
> desired context.  Not yet implemented; hence the RFC.
> 
> It exploits the fact that "--" is consumed as the end-of-options,
> hence, there is no way for "" to be recognized as a valid option
> name, so the only way we can encounter VSH_OT_ARGV is via the
> new argv handling, at which point we can handle all remaining
> command line arguments.

  Interesting, so you could use echo to build scripts where
escaping it automatically provided by an earlier use of virsh.
Sounds good to me !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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