adjust cli argument order

This commit is contained in:
Robert Kaussow 2021-07-27 22:01:56 +02:00
parent ee853ce8da
commit 4b28c6339f
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
2 changed files with 12 additions and 12 deletions

View File

@ -59,6 +59,14 @@ class AnsibleDoctor:
default=None,
help="dry run without writing"
)
parser.add_argument(
"-n",
"--no-role-detection",
dest="role_detection",
action="store_false",
default=None,
help="disable automatic role detection"
)
parser.add_argument(
"-v", dest="logging.level", action="append_const", const=-1, help="increase log level"
)
@ -68,14 +76,6 @@ class AnsibleDoctor:
parser.add_argument(
"--version", action="version", version="%(prog)s {}".format(__version__)
)
parser.add_argument(
"-n",
"--no-role-detection",
dest="no_role_detection",
action="store_true",
default=None,
help="disable role detection"
)
return parser.parse_args().__dict__
@ -90,7 +90,7 @@ class AnsibleDoctor:
except ValueError as e:
self.log.sysexit_with_message("Can not set log level.\n{}".format(str(e)))
if not config.config["no_role_detection"]:
if config.config["role_detection"]:
if config.is_role:
self.logger.info("Ansible role detected")
else:

View File

@ -97,9 +97,9 @@ class Config():
"file": True,
"type": environs.Env().list
},
"no_role_detection": {
"default": False,
"env": "NO_ROLE_DETECTION",
"role_detection": {
"default": True,
"env": "ROLE_DETECTION",
"file": True,
"type": environs.Env().bool
},