| 1 | #!/system/bin/sh |
| 2 | |
| 3 | show_usage () { |
| 4 | echo "usage: termux-toast [-s|--short]" |
| 5 | echo "Show the text from stdin in a Toast (a transient popup). Options:" |
| 6 | echo " -s, --short only show the toast for a short while" |
| 7 | } |
| 8 | |
| 9 | PARAMS="" |
| 10 | O=`busybox getopt -q -l short -l help -- sh "$@"` |
| 11 | if [ $? != 0 ] ; then show_usage; exit 1 ; fi |
| 12 | eval set -- "$O" |
| 13 | while true; do |
| 14 | case "$1" in |
| 15 | -s|--short) PARAMS="$PARAMS --ez short true"; shift 1;; |
| 16 | -h|--help) show_usage; exit 0;; |
| 17 | --) shift; break;; |
| 18 | *) echo Error; exit 1;; |
| 19 | esac |
| 20 | done |
| 21 | |
| 22 | if [ $# != 0 ]; then show_usage; exit 1; fi |
| 23 | |
| 24 | termux-api Toast $PARAMS |