From 13d2a2fb714eaa61afbe2c5c2e9ac75a2299f873 Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Tue, 20 Aug 2024 08:51:08 -0400 Subject: [PATCH] Add a cli argument for overriding the locker branch (#11) --- prune/cli.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/prune/cli.py b/prune/cli.py index e5d4594..ae5684e 100644 --- a/prune/cli.py +++ b/prune/cli.py @@ -20,6 +20,7 @@ from urllib.parse import urlparse from compliance.utils.credentials import Config +from compliance.config import get_config from ilcli import Command @@ -36,6 +37,11 @@ def _init_arguments(self): "as an example https://github.com/my-org/my-repo" ), ) + self.add_argument( + "--branch", + help="Branch name for locker repository", + default=False, + ) self.add_argument( "--creds", metavar="~/path/creds", @@ -88,6 +94,10 @@ def _run(self, args): gitconfig = None if args.git_config or args.git_config_file: gitconfig = args.git_config or json.loads(open(args.git_config_file).read()) + if args.branch: + c = get_config() + c.load() + c.raw_config["locker"]["default_branch"] = args.branch # self.name drives the Locker push mode. # - dry-run translates to locker no-push mode # - push-remote translates to locker full-remote mode