[virt-manager PATCH 4/9] cli: add fail helper for 2 conflicting cli options
Pino Toscano
ptoscano at redhat.com
Thu Sep 17 06:44:01 UTC 2020
It will avoid repeating the same message in different places.
Signed-off-by: Pino Toscano <ptoscano at redhat.com>
---
virtinst/cli.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 8a06e8b2..91f40f31 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -474,6 +474,16 @@ def get_domain_and_guest(conn, domstr):
return (domain, inactive_xmlobj, active_xmlobj)
+def fail_conflicting(option1, option2):
+ # translators: option1 and option2 are command line options,
+ # e.g. -a or --disk
+ msg = _("Cannot use %(option1)s and %(option2)s at the same time") % {
+ "option1": option1,
+ "option2": option2,
+ }
+ fail(msg)
+
+
###########################
# bash completion helpers #
###########################
--
2.26.2
More information about the virt-tools-list
mailing list