ncdc: Update from 1.19.1 to 1.20
[termux-packages] / packages / termux-api / termux-toast
CommitLineData
cc1ae02e 1#!/bin/sh
bea93fbd 2set -e -u
17d445b3 3
bea93fbd 4SCRIPTNAME=termux-toast
17d445b3 5show_usage () {
bea93fbd
FF
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."
bea93fbd 8 echo " -s only show the toast for a short while"
bea93fbd 9 exit 0
17d445b3
FF
10}
11
12PARAMS=""
bea93fbd
FF
13while getopts :hs option
14do
15 case "$option" in
16 h) show_usage;;
17 s) PARAMS="--ez short true";;
18 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
19 esac
17d445b3 20done
bea93fbd 21shift $(($OPTIND-1))
17d445b3 22
bea93fbd
FF
23CMD="@TERMUX_API@ Toast $PARAMS"
24if [ $# = 0 ]; then
25 $CMD
26else
27 echo $@ | $CMD
28fi