build: allow release options only in combination with --release

It leads to weird expectations when using --db-update or --message
without --release. Make the behavior more user friendly, by aborting the
operation and explaining that release options only work in conjunction
with the release option.

Fixes #131

Signed-off-by: Christian Heusel <christian@heusel.eu>
This commit is contained in:
Christian Heusel 2023-04-18 01:15:24 +02:00 committed by Levente Polyak
parent ed96635141
commit 4289be212b
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
2 changed files with 13 additions and 1 deletions

View File

@ -60,7 +60,9 @@ Release Options
---------------
*-r, --release*::
Automatically commit, tag and release after building
Automatically commit, tag and release after building +
Specifying this option is required when using any of the following options
in this section
*-m, --message* 'MSG'::
Use the given <msg> as the commit message

View File

@ -238,6 +238,16 @@ pkgctl_build() {
esac
done
# check if any release specific options were specified without releasing
if (( ! RELEASE )); then
if (( DB_UPDATE )); then
die "cannot use --db-update without --release"
fi
if [[ -n "${MESSAGE}" ]]; then
die "cannot use --message without --release"
fi
fi
# check if invoked without any path from within a packaging repo
if (( ${#paths[@]} == 0 )); then
if [[ -f PKGBUILD ]]; then