mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-04-19 06:42:18 +03:00
apkgrel: fix usage and invalid options and add test
This commit is contained in:
parent
115e41fd1f
commit
3695cd2008
@ -73,9 +73,9 @@ do_nothing() {
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat >&2 <<-__EOF__
|
||||
cat <<-__EOF__
|
||||
$program $program_version - display or bump pkgrel in APKBUILDs
|
||||
Usage: $program [-z|--zero] [-a|--add] [-g|--clean-git] [-s|--set NUM]
|
||||
usage: $program [-z|--zero] [-a|--add] [-g|--clean-git] [-s|--set NUM]
|
||||
[-t|--test] [-f|--force] DIR or APKBUILD...
|
||||
Options:
|
||||
-z, --zero Set pkgrel to 0
|
||||
@ -98,7 +98,7 @@ only_clean_git=
|
||||
args=$(getopt -o zags:tfqh --long zero,add,clean-git,set:,test,force,quiet,help \
|
||||
-n "$program" -- "$@")
|
||||
if [ $? -ne 0 ]; then
|
||||
usage
|
||||
usage >&2
|
||||
exit 2
|
||||
fi
|
||||
eval set -- "$args"
|
||||
@ -121,7 +121,7 @@ while true; do
|
||||
shift
|
||||
done
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
usage >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
13
tests/apkgrel_test
Executable file
13
tests/apkgrel_test
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env atf-sh
|
||||
|
||||
. $(atf_get_srcdir)/test_env.sh
|
||||
init_tests \
|
||||
apkgrel_usage
|
||||
|
||||
export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
|
||||
|
||||
apkgrel_usage_body() {
|
||||
atf_check -o match:"usage" apkgrel -h
|
||||
atf_check -s exit:2 -e match:"usage" apkgrel -Z
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user