From 594da2b2dfb9518d22abe5490901da447564bafa Mon Sep 17 00:00:00 2001 From: Michal Bocek Date: Tue, 26 Sep 2023 16:46:33 +0000 Subject: [PATCH] Move -y option out of parent options (#936) The -y option was being registered under the parent options (as if not related to subcommands) but it is more appropriate to have it under the subcommand options. --- convert2rhel/toolopts.py | 10 +++++----- man/__init__.py | 2 +- man/convert2rhel.8 | 22 +++++++++------------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/convert2rhel/toolopts.py b/convert2rhel/toolopts.py index c9222b475..74b328591 100644 --- a/convert2rhel/toolopts.py +++ b/convert2rhel/toolopts.py @@ -169,11 +169,6 @@ def _register_parent_options(parser): action="store_true", help="Print traceback in case of an abnormal exit and messages that could help find an issue.", ) - parser.add_argument( - "-y", - help="Answer yes to all yes/no questions the tool asks.", - action="store_true", - ) def _register_options(self): """Prescribe what command line options the tool accepts.""" @@ -217,6 +212,11 @@ def _register_options(self): " It has no effect when used with the 'analyze' subcommand.", action="store_true", ) + self._shared_options_parser.add_argument( + "-y", + help="Answer yes to all yes/no questions the tool asks.", + action="store_true", + ) self._add_subscription_manager_options() self._add_alternative_installation_options() diff --git a/man/__init__.py b/man/__init__.py index b83ea1b0a..6c229de03 100644 --- a/man/__init__.py +++ b/man/__init__.py @@ -25,7 +25,7 @@ def get_parser(): Generate the manpage locally by running the following in the root of the git repo: $ sudo dnf install -y argparse-manpage $ python -c 'from convert2rhel import toolopts; print("[synopsis]\n."+toolopts.CLI.usage())' > man/synopsis - $ PYTHONPATH=$PYTHONPATH:`pwd` argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel " --prog="convert2rhel" --include man/synopsis > man/convert2rhel.8 + $ PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel " --prog="convert2rhel" --include man/distribution --include man/synopsis > man/convert2rhel.8 """ parser = toolopts.CLI()._parser diff --git a/man/convert2rhel.8 b/man/convert2rhel.8 index 400847c42..674dddd5e 100644 --- a/man/convert2rhel.8 +++ b/man/convert2rhel.8 @@ -1,4 +1,4 @@ -.TH CONVERT2RHEL "1" "2023\-09\-19" "convert2rhel 1.5.0" "General Commands Manual" +.TH CONVERT2RHEL "1" "2023\-09\-26" "convert2rhel 1.5.0" "General Commands Manual" .SH NAME convert2rhel \- Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux. .SH SYNOPSIS @@ -20,10 +20,6 @@ Show convert2rhel version and exit. Print traceback in case of an abnormal exit and messages that could help find an issue. -.TP -\fB\-y\fR -Answer yes to all yes/no questions the tool asks. - .SH SUBCOMMANDS .TP @@ -50,10 +46,6 @@ Show convert2rhel version and exit. Print traceback in case of an abnormal exit and messages that could help find an issue. -.TP -\fB\-y\fR -Answer yes to all yes/no questions the tool asks. - .TP \fB\-\-no\-rpm\-va\fR Skip gathering changed rpm files using 'rpm \-Va'. By default it's performed @@ -79,6 +71,10 @@ use this option multiple times. This option defaults to all repositories Restart the system when it is successfully converted to RHEL to boot the new RHEL kernel. It has no effect when used with the 'analyze' subcommand. +.TP +\fB\-y\fR +Answer yes to all yes/no questions the tool asks. + .SH SUBSCRIPTION MANAGER OPTIONS \fI\,'convert2rhel analyze'\/\fR The following options are specific to using subscription\-manager. @@ -187,10 +183,6 @@ Show convert2rhel version and exit. Print traceback in case of an abnormal exit and messages that could help find an issue. -.TP -\fB\-y\fR -Answer yes to all yes/no questions the tool asks. - .TP \fB\-\-no\-rpm\-va\fR Skip gathering changed rpm files using 'rpm \-Va'. By default it's performed @@ -216,6 +208,10 @@ use this option multiple times. This option defaults to all repositories Restart the system when it is successfully converted to RHEL to boot the new RHEL kernel. It has no effect when used with the 'analyze' subcommand. +.TP +\fB\-y\fR +Answer yes to all yes/no questions the tool asks. + .SH SUBSCRIPTION MANAGER OPTIONS \fI\,'convert2rhel convert'\/\fR The following options are specific to using subscription\-manager.