summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/is_built6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/is_built b/src/is_built
index e6797fd..a1da507 100755
--- a/src/is_built
+++ b/src/is_built
@@ -2,7 +2,7 @@
cmd=${0##*/}
usage() {
- echo "Usage: $cmd [-h] pkgname pkgver"
+ echo "Usage: $cmd [-h] pkgname [pkgver]"
echo
echo "Detect if a given package version is already in repos"
echo "Assuming you want greater or equal."
@@ -21,13 +21,13 @@ while getopts 'h' arg; do
*) usage >&2; exit 2 ;;
esac
done
-if [[ $# != 2 ]]; then
+if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
usage >&2
exit 2
fi
pkg=${1}
-ver=${2}
+ver=${2:-0}
pver=$(LC_ALL=C pacman -Sddp --print-format '%v' "${pkg}" 2>/dev/null)
# if pacman fails or returns nothing