mirror of
https://github.com/derrod/legendary.git
synced 2025-01-03 04:45:28 +00:00
[cli] Allow -y/--yes to be specified as part of the subcommand arguments
This commit is contained in:
parent
1598844bc6
commit
22b7db7a29
|
@ -1294,10 +1294,10 @@ 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 --yes is used as part of the subparsers arguments manually set the flag in the main parser.
|
||||
if '-y' in extra or '--yes' in extra:
|
||||
logger.warning('-y/--yes flag needs to be specified *before* the command name')
|
||||
args.yes = True
|
||||
extra = [i for i in extra if i not in ('--yes', '-y')]
|
||||
|
||||
# technically args.func() with setdefaults could work (see docs on subparsers)
|
||||
# but that would require all funcs to accept args and extra...
|
||||
|
|
Loading…
Reference in a new issue