From 17d445b3f3619ab39192331b20a99c349ed13f38 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Wed, 29 Jul 2015 04:09:18 +0200 Subject: [PATCH] termux-api: Add termux-toast --- packages/termux-api/termux-toast | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 packages/termux-api/termux-toast diff --git a/packages/termux-api/termux-toast b/packages/termux-api/termux-toast new file mode 100755 index 00000000..e54b04f1 --- /dev/null +++ b/packages/termux-api/termux-toast @@ -0,0 +1,24 @@ +#!/system/bin/sh + +show_usage () { + echo "usage: termux-toast [-s|--short]" + echo "Show the text from stdin in a Toast (a transient popup). Options:" + echo " -s, --short only show the toast for a short while" +} + +PARAMS="" +O=`busybox getopt -q -l short -l help -- sh "$@"` +if [ $? != 0 ] ; then show_usage; exit 1 ; fi +eval set -- "$O" +while true; do +case "$1" in + -s|--short) PARAMS="$PARAMS --ez short true"; shift 1;; + -h|--help) show_usage; exit 0;; + --) shift; break;; + *) echo Error; exit 1;; +esac +done + +if [ $# != 0 ]; then show_usage; exit 1; fi + +termux-api Toast $PARAMS -- 2.11.0