From 73c903b8b64797e950f791c33831381374c0ba61 Mon Sep 17 00:00:00 2001 From: skullY Date: Wed, 8 Apr 2020 09:37:53 -0700 Subject: [PATCH] Add --no flag --- qmk_cli/subcommands/setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qmk_cli/subcommands/setup.py b/qmk_cli/subcommands/setup.py index 19b75c5..12a8204 100644 --- a/qmk_cli/subcommands/setup.py +++ b/qmk_cli/subcommands/setup.py @@ -14,7 +14,8 @@ default_fork = 'qmk/' + default_repo default_branch = 'master' -@cli.argument('-y', '--yes', action='store_true', help='Answer yes to all questions') +@cli.argument('-n', '--no', arg_only=True, action='store_true', help='Answer no to all questions') +@cli.argument('-y', '--yes', arg_only=True, action='store_true', help='Answer yes to all questions') @cli.argument('--baseurl', default='https://github.com', help='The URL all git operations start from') @cli.argument('-b', '--branch', default=default_branch, help='The branch to clone') @cli.argument('destination', default=os.environ['QMK_HOME'], nargs='?', help='The directory to clone to') @@ -23,6 +24,11 @@ default_branch = 'master' def setup(cli): qmk_firmware = Path(cli.args.destination) + # Sanity checks + if cli.args.yes and cli.args.no: + cli.log.error("Can't use both --yes and --no at the same time.") + exit(1) + # Check on qmk_firmware, and if it doesn't exist offer to check it out. if qmk_firmware.exists(): cli.log.info('Found qmk_firmware at %s.', str(qmk_firmware))