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, default=None,
help="dry run without writing" 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( parser.add_argument(
"-v", dest="logging.level", action="append_const", const=-1, help="increase log level" "-v", dest="logging.level", action="append_const", const=-1, help="increase log level"
) )
@ -68,14 +76,6 @@ class AnsibleDoctor:
parser.add_argument( parser.add_argument(
"--version", action="version", version="%(prog)s {}".format(__version__) "--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__ return parser.parse_args().__dict__
@ -90,7 +90,7 @@ class AnsibleDoctor:
except ValueError as e: except ValueError as e:
self.log.sysexit_with_message("Can not set log level.\n{}".format(str(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: if config.is_role:
self.logger.info("Ansible role detected") self.logger.info("Ansible role detected")
else: else:

View File

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