termux-api: Add termux-vibrate -f/--force option
[termux-packages] / packages / termux-api / termux-dialog
1 #!/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 <hint> The input hint to show when the input is empty"
10 echo " -m, --multiple-lines Use a textarea with multiple lines instead of a single"
11 echo " -p, --password Enter the input as a password"
12 echo " -t, --title <title> The title to show for the input prompt"
13 }
14
15 PARAMS=""
16 O=`busybox getopt -q -l help -l input-hint: -l multiple-lines -l password -l title: -- hi:mpt: "$@"`
17 if [ $? != 0 ] ; then show_usage; exit 1 ; fi
18 eval set -- "$O"
19 while true; do
20 case "$1" in
21 -h|--help) show_usage; exit 0;;
22 -i|--input-hint) PARAMS="$PARAMS --es input_hint '$2'"; shift 2;;
23 -m|--multiple-lines) PARAMS="$PARAMS --ez multiple_lines true"; shift 1;;
24 -p|--password) PARAMS="$PARAMS --es input_type password"; shift 1;;
25 -t|--title) PARAMS="$PARAMS --es input_title '$2'"; shift 2;;
26 --) shift; break;;
27 *) echo Error; exit 1;;
28 esac
29 done
30
31 # Too many arguments:
32 if [ $# != 0 ]; then show_usage; exit 1; fi
33
34 eval @TERMUX_API@ Dialog $PARAMS