From cd830514737d448ac799c42822978724c83f12b1 Mon Sep 17 00:00:00 2001 From: dcookspi <92065525+dcookspi@users.noreply.github.com> Date: Wed, 15 May 2024 12:12:28 -0700 Subject: [PATCH] Add `--no-publish/--no` option to `spk-convert-pip` (#1015) * Adds --no-publish/--no option to spk-convert-pip script. This allows the user by pass the "Do you want to also publish these packages? [y/N]: " question, effectively pre-answering it with 'no'. Signed-off-by: David Gilligan-Cook --- packages/spk-convert-pip/spk-convert-pip | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/spk-convert-pip/spk-convert-pip b/packages/spk-convert-pip/spk-convert-pip index 226efca79c..0f1dc70b61 100755 --- a/packages/spk-convert-pip/spk-convert-pip +++ b/packages/spk-convert-pip/spk-convert-pip @@ -53,11 +53,18 @@ def main() -> int: default="origin", help="The repository to publish to. Any configured spfs repository can be named here.", ) - pip_cmd.add_argument( + group = pip_cmd.add_mutually_exclusive_group() + group.add_argument( "--publish", default=None, action="store_true", - help="Also publish the packages after convert", + help="Also publish the packages after conversion. Does not ask if you want to publish, assumes yes", + ) + group.add_argument( + "--no-publish", + default=None, + action="store_true", + help="Do not publish the packages after conversion. Does not ask if you want to publish, assumes no", ) pip_cmd.add_argument( "--force", @@ -98,7 +105,7 @@ def main() -> int: print(f" {spec.get('pkg')}") print("") - if args.publish is None: + if args.publish is None and not args.no_publish: print("These packages are now available in the local repository") args.publish = bool( input("Do you want to also publish these packages? [y/N]: ").lower()