termux-api: Remove empty lines from -h output
[termux-packages] / packages / termux-api / termux-toast
1 #!/bin/sh
2 set -e -u
3
4 SCRIPTNAME=termux-toast
5 show_usage () {
6 echo "Usage: termux-toast [-s] [text]"
7 echo "Show text in a Toast (a transient popup). The text to show is either supplied as arguments or read from stdin if no arguments are given."
8 echo " -s only show the toast for a short while"
9 exit 0
10 }
11
12 PARAMS=""
13 while getopts :hs option
14 do
15 case "$option" in
16 h) show_usage;;
17 s) PARAMS="--ez short true";;
18 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
19 esac
20 done
21 shift $(($OPTIND-1))
22
23 CMD="@TERMUX_API@ Toast $PARAMS"
24 if [ $# = 0 ]; then
25 $CMD
26 else
27 echo $@ | $CMD
28 fi