From 033eb77aa92ad945d69b49d697417d9714857aa2 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 13 Jul 2023 16:01:09 +0200 Subject: spack buildcache push: improve argparse (#38876) --- lib/spack/spack/cmd/buildcache.py | 19 +++++++++++-------- share/spack/spack-completion.bash | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py index c3afa195bd..0a59ee9eaf 100644 --- a/lib/spack/spack/cmd/buildcache.py +++ b/lib/spack/spack/cmd/buildcache.py @@ -45,15 +45,18 @@ def setup_parser(subparser): push = subparsers.add_parser("push", aliases=["create"], help=push_fn.__doc__) push.add_argument("-f", "--force", action="store_true", help="overwrite tarball if it exists") push.add_argument( - "-u", "--unsigned", action="store_true", help="push unsigned buildcache tarballs" - ) - push.add_argument( - "-a", "--allow-root", + "-a", action="store_true", help="allow install root string in binary files after RPATH substitution", ) - push.add_argument("-k", "--key", metavar="key", type=str, default=None, help="key for signing") + push_sign = push.add_mutually_exclusive_group(required=False) + push_sign.add_argument( + "--unsigned", "-u", action="store_true", help="push unsigned buildcache tarballs" + ) + push_sign.add_argument( + "--key", "-k", metavar="key", type=str, default=None, help="key for signing" + ) push.add_argument("mirror", type=str, help="mirror name, path, or URL") push.add_argument( "--update-index", @@ -70,9 +73,9 @@ def setup_parser(subparser): default="package,dependencies", dest="things_to_install", choices=["package", "dependencies"], - help="select the buildcache mode\n\n" - "the default is to build a cache for the package along with all its dependencies. " - "alternatively, one can decide to build a cache for only the package or only the " + help="select the buildcache mode. " + "The default is to build a cache for the package along with all its dependencies. " + "Alternatively, one can decide to build a cache for only the package or only the " "dependencies", ) arguments.add_common_arguments(push, ["specs"]) diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index e9e28dcfd9..f2275e27d4 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -498,7 +498,7 @@ _spack_buildcache() { _spack_buildcache_push() { if $list_options then - SPACK_COMPREPLY="-h --help -f --force -u --unsigned -a --allow-root -k --key --update-index --rebuild-index --spec-file --only" + SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --key -k --update-index --rebuild-index --spec-file --only" else _mirrors fi @@ -507,7 +507,7 @@ _spack_buildcache_push() { _spack_buildcache_create() { if $list_options then - SPACK_COMPREPLY="-h --help -f --force -u --unsigned -a --allow-root -k --key --update-index --rebuild-index --spec-file --only" + SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --key -k --update-index --rebuild-index --spec-file --only" else _mirrors fi -- cgit v1.2.3-70-g09d2