• O
    virsh: Categorize commands into groups for virsh help · 78290527
    Osier Yang 提交于
    Change the virsh help out. The new output of "virsh help" and
    "virsh --help" will be like:
    
     Secret (help keyword 'secret'):
        secret-define                  define or modify a secret from an XML file
        secret-dumpxml                 secret attributes in XML
        secret-set-value               set a secret value
        secret-get-value               Output a secret value
        secret-undefine                undefine a secret
        secret-list                    list secrets
    
     Snapshot (help keyword 'snapshot'):
        snapshot-create                Create a snapshot
        snapshot-current               Get the current snapshot
        snapshot-delete                Delete a domain snapshot
        snapshot-dumpxml               Dump XML for a domain snapshot
        snapshot-list                  List snapshots for a domain
        snapshot-revert                Revert a domain to a snapshot
    
    Also support output help information of specified command group, e.g.
    
    % ./tools/virsh help "Network Filter"
     Network Filter (help keyword 'filter'):
        nwfilter-define                define or update a network filter from an XML file
        nwfilter-undefine              undefine a network filter
        nwfilter-dumpxml               network filter information in XML
        nwfilter-list                  list network filters
        nwfilter-edit                  edit XML configuration for a network filter
    
    Each group has a help keyword, e.g.
    
    % ./tools/virsh help filter
     Network Filter (help keyword 'filter'):
        nwfilter-define                define or update a network filter from an XML file
        nwfilter-undefine              undefine a network filter
        nwfilter-dumpxml               network filter information in XML
        nwfilter-list                  list network filters
        nwfilter-edit                  edit XML configuration for a network filter
    
    * tools/virsh.c:
      - introduce new struct "vshCmdGrp" and macros to define the groups.
      - split previous array "commands" into small arrays which are orgnized
        by group
      - changed some functions, e.g. "vshCmdDefSearch"
      - Added new functions, e.g. "vshCmdGrpSearch"
      - commands of each group are in "alphabetical order" now.
      - command groups are in "alphabetical order" now.
      - the commands are categorized with reference of
        http://wiki.libvirt.org/page/VirshHelpV2 (by Justin)
      - the modifications doesn't affect tests
    
    * TODO:
      - doc
    78290527
virsh.c 333.5 KB