aboutsummaryrefslogtreecommitdiff
path: root/aux/lib.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-01 10:38:26 -0300
committerEuAndreh <eu@euandre.org>2023-04-01 10:38:31 -0300
commitfea2fc7600315163eb20ff39845e12b23bdadd65 (patch)
tree8f37a5fd3a91c3c6a9ff95fd255c7fc54f3c32ba /aux/lib.sh
parentUpdate po/ with newer strings (diff)
downloadremembering-fea2fc7600315163eb20ff39845e12b23bdadd65.tar.gz
remembering-fea2fc7600315163eb20ff39845e12b23bdadd65.tar.xz
aux/lib.sh: Add generic assert_arg()
Diffstat (limited to 'aux/lib.sh')
-rw-r--r--aux/lib.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/aux/lib.sh b/aux/lib.sh
index 52f1315..e345bd6 100644
--- a/aux/lib.sh
+++ b/aux/lib.sh
@@ -1,8 +1,14 @@
#!/bin/sh
-#
-# Generally, utilities that I expected to exist in POSIX, but don't.
-#
+assert_arg() {
+ if [ -z "$1" ]; then
+ printf 'Missing %s.\n\n' "$2" >&2
+ cat <<-'EOF'
+ usage >&2
+ exit 2
+ EOF
+ fi
+}
uuid() {
od -xN20 /dev/urandom |