From 4f43ce3e4a7829cf9c7f8b28925ddb5a1013ce19 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Tue, 29 Nov 2022 00:40:27 +1000 Subject: [PATCH] repo-add: use parseopts from libmakepkg Signed-off-by: Allan McRae --- scripts/repo-add.sh.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 221abdc0..598698e3 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -47,6 +47,7 @@ INCLUDE_SIGS=0 # Import libmakepkg source "$LIBRARY"/util/compress.sh source "$LIBRARY"/util/message.sh +source "$LIBRARY"/util/parseopts.sh # ensure we have a sane umask set umask 0022 @@ -601,6 +602,16 @@ done trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR + +OPT_SHORT="knpqRsv" +OPT_LONG=('include-sigs' 'key' 'new' 'nocolor' 'quiet' 'prevent-downgrade' 'remove' + 'sign' 'verify') +if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then + exit 1 # E_INVALID_OPTION +fi +set -- "${OPTRET[@]}" +unset OPT_SHORT OPT_LONG OPTRET + declare -a args # parse arguments while (( $# )); do