libcaca: --disable-ruby to fix build on mac
[termux-packages] / packages / termux-api / termux-notification
index 96a0e2a..ecac9ae 100755 (executable)
@@ -3,14 +3,16 @@ set -e -u
 
 SCRIPTNAME=termux-notification
 show_usage () {
-       echo "usage: termux-notification [OPTIONS]"
-       echo "Display a system notification."
-       echo ""
-       echo "  -c <content> notification content to show"
-       echo "  -i <id>      notification id (will overwrite the previous notification with the same id)"
-       echo "  -t <title>   notification title to show"
-       echo "  -u <url>     notification url when clicking on it"
-       exit 1
+    echo "Usage: termux-notification [-c content] [-i id] [-t title] [-u url]"
+    echo "Display a system notification."
+    echo ""
+    echo "  -c content notification content to show"
+    echo "  -i id      notification id (will overwrite any previous notification"
+    echo "               with the same id)"
+    echo "  -t title   notification title to show"
+    echo "  -u url     notification url when clicking on it"
+    echo ""
+    exit 0
 }
 
 CONTENT_OR_TITLE_SET=no
@@ -43,4 +45,10 @@ if [ $CONTENT_OR_TITLE_SET = "no" ]; then
        exit 1
 fi
 
-@TERMUX_API@ Notification $ARG_C "$OPT_C" $ARG_I "$OPT_I" $ARG_T "$OPT_T" $ARG_U "$OPT_U"
+set --
+if [ -n "$ARG_C" ]; then set -- "$@" $ARG_C "$OPT_C"; fi
+if [ -n "$ARG_I" ]; then set -- "$@" $ARG_I "$OPT_I"; fi
+if [ -n "$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi
+if [ -n "$ARG_U" ]; then set -- "$@" $ARG_U "$OPT_U"; fi
+
+@TERMUX_API@ Notification "$@"