| 1 | #!/system/bin/sh |
| 2 | |
| 3 | set -e -u |
| 4 | |
| 5 | SCRIPTNAME=$0 |
| 6 | show_usage () { |
| 7 | echo "usage: $SCRIPTNAME [OPTIONS]" |
| 8 | echo " Show a text entry dialog." |
| 9 | echo " -i, --input-hint The input hint to show when the textarea is empty" |
| 10 | } |
| 11 | |
| 12 | PARAMS="" |
| 13 | O=`busybox getopt -q -l help -l input-hint: -- hi: "$@"` |
| 14 | if [ $? != 0 ] ; then show_usage; exit 1 ; fi |
| 15 | eval set -- "$O" |
| 16 | while true; do |
| 17 | case "$1" in |
| 18 | -h|--help) show_usage; exit 0;; |
| 19 | -i|--input-hint) PARAMS="$PARAMS --es input_hint '$2'"; shift 2;; |
| 20 | --) shift; break;; |
| 21 | *) echo Error; exit 1;; |
| 22 | esac |
| 23 | done |
| 24 | |
| 25 | # Too many arguments: |
| 26 | if [ $# != 0 ]; then show_usage; exit 1; fi |
| 27 | |
| 28 | eval termux-api Dialog $PARAMS |