• E
    virsh: Treat any command name starting with # as comment · 4e650259
    Eric Blake 提交于
    As the previous commit mentioned, argv mode (such as when you feed
    virsh via stdin with <<\EOF instead of via a single shell argument)
    didn't permit comments. Do this by treating any command name token
    that starts with # as a comment which silently eats all remaining
    arguments to the next newline or semicolon.
    
    Note that batch mode recognizes unquoted # at the start of any word as
    a command as part of the tokenizer, while this patch only treats # at
    the start of the command word as a comment (any other # remaining by
    the time vshCommandParse() is processing things was already quoted
    during the tokenzier, and as such was probably intended as the actual
    argument to the command word earlier in the line).
    
    Now I can do something like:
    
    $ virsh -c test:///default <<EOF
      # setup
      snapshot-create-as test s1
      snapshot-create-as test s2
      # check
      snapshot-list test --name
    EOF
    Signed-off-by: NEric Blake <eblake@redhat.com>
    Acked-by: NMichal Privoznik <mprivozn@redhat.com>
    4e650259
vsh.c 91.3 KB