From 4b28c6339f0c76e06fc216dbd30d1f07a1ab82b5 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 27 Jul 2021 22:01:56 +0200 Subject: [PATCH] adjust cli argument order --- ansibledoctor/cli.py | 18 +++++++++--------- ansibledoctor/config.py | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ansibledoctor/cli.py b/ansibledoctor/cli.py index 693dbc6..a409aa3 100644 --- a/ansibledoctor/cli.py +++ b/ansibledoctor/cli.py @@ -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: diff --git a/ansibledoctor/config.py b/ansibledoctor/config.py index 8752ae9..25844c8 100644 --- a/ansibledoctor/config.py +++ b/ansibledoctor/config.py @@ -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 },