virt-xml: add "-c" as short option of "--connect"

Add "-c" as short option of "--connect" for virt-xml.

We could use either
virt-xml -c lxc:///
or
virt-xml --connect lxc:///

This will be more convenient if we operate
non-default hypervisor.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
Chen Hanxiao 2014-02-12 22:57:40 +08:00
parent cbec4b10ab
commit b53b3874a4
3 changed files with 9 additions and 5 deletions

View File

@ -37,7 +37,7 @@ Show the help message and exit
Show program's version number and exit
=item --connect=URI
=item -c URI, --connect=URI
Connect to a non-default hypervisor. See L<virt-install(1)> for details

View File

@ -299,7 +299,7 @@ def parse_args():
_("Edit libvirt XML using command line options."),
introspection_epilog=True)
cli.add_connect_option(parser)
cli.add_connect_option(parser, "virt-xml")
parser.add_argument("domain", nargs='?',
help=_("Domain name, id, or uuid"))

View File

@ -552,9 +552,13 @@ def set_os_variant(obj, distro_type, distro_variant):
# Common CLI option/group #
#############################
def add_connect_option(parser):
parser.add_argument("--connect", metavar="URI",
help=_("Connect to hypervisor with libvirt URI"))
def add_connect_option(parser, invoker=None):
if invoker == "virt-xml":
parser.add_argument("-c", "--connect", metavar="URI",
help=_("Connect to hypervisor with libvirt URI"))
else:
parser.add_argument("--connect", metavar="URI",
help=_("Connect to hypervisor with libvirt URI"))
def add_misc_options(grp, prompt=False, replace=False,