Re: [virt-manager] [PATCH 1/2] cli: Replace '_' from cli_arg_name with '-' before saving to parsernames

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

 



On 12/24/2018 03:35 AM, Lin Ma wrote:
The patch makes --qemu-commandline subprops completion works.

Signed-off-by: Lin Ma <lma@xxxxxxxx>
---
  virtinst/cli.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/virtinst/cli.py b/virtinst/cli.py
index 21586b19..3ba81861 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -494,7 +494,8 @@ def autocomplete(parser):
import argcomplete - parsernames = ["--" + pclass.cli_arg_name for pclass in VIRT_PARSERS]
+    parsernames = ["--" + pclass.cli_arg_name.replace("_", "-")
+                   for pclass in VIRT_PARSERS]
      # pylint: disable=protected-access
      for action in parser._actions:
          for opt in action.option_strings:


Good catch. But looks like there's some other incorrect cli_arg_name usages as well. Can you add something like

@classmethod
def cli_flag_name(cls):
    return "--" + cls.cli_arg_name.replace("_", "-")

And convert the other incorrect cli_arg_name users to it. For example the underscore printed here:

$ ./virt-xml --qemu-commandline=help
--qemu_commandline options:
  args
  clearxml
  env


Thanks,
Cole

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux