zsh: Update to 5.1.1 from 5.1
[termux-packages] / packages / termux-api / termux-notification
CommitLineData
cc1ae02e 1#!/bin/sh
59f0d218
FF
2
3set -u
4
5PARAMS=""
6CONTENT_OR_TITLE_SET=no
7
8SCRIPTNAME=$0
9show_usage () {
10 echo "usage: termux-notification [OPTIONS]"
11 echo "Display a notification. Options:"
12 echo " -c, --content <content> notification content to show"
13 echo " -i, --id <id> notification id (will overwrite the previous notification with the same id)"
14 echo " -t, --title <title> notification title to show"
15 echo " -u, --url <url> notification url when clicking on it"
16}
17
18O=`busybox getopt -q -l content: -l help -l title: -l id: -l url: -- c:hi:t:u: "$@"`
19if [ $? != 0 ] ; then show_usage; exit 1 ; fi
20eval set -- "$O"
21while true; do
22case "$1" in
5b8f3e4a 23 -c|--content) PARAMS="$PARAMS --es content '$2'"; CONTENT_OR_TITLE_SET=yes; shift 2;;
59f0d218
FF
24 -h|--help) show_usage; exit 0;;
25 -i|--id) PARAMS="$PARAMS --es id $2"; shift 2;;
5b8f3e4a
FF
26 -t|--title) PARAMS="$PARAMS --es title '$2'"; CONTENT_OR_TITLE_SET=yes; shift 2;;
27 -u|--url) PARAMS="$PARAMS --es url '$2'"; shift 2;;
59f0d218
FF
28 --) shift; break;;
29 *) echo Error; exit 1;;
30esac
31done
32
33if [ $CONTENT_OR_TITLE_SET = "no" ]; then
34 show_usage
35 exit 1;
36fi;
37
5b8f3e4a 38eval @TERMUX_API@ Notification $PARAMS