[cli] Show warning for incorrect -y/--yes usage

This commit is contained in:
derrod 2020-06-01 08:12:24 +02:00
parent 5eecabfb4a
commit 6051edc636

View file

@ -1111,6 +1111,11 @@ def main():
logging.getLogger('requests').setLevel(logging.WARNING)
logging.getLogger('urllib3').setLevel(logging.WARNING)
# -y having to be specified before the subcommand is a little counter-intuitive
# For now show a warning if a user is misusing that flag
if '-y' in extra or '--yes' in extra:
logger.warning('-y/--yes flag needs to be specified *before* the command name')
# technically args.func() with setdefaults could work (see docs on subparsers)
# but that would require all funcs to accept args and extra...
try: