golang: Update from 1.6.1 to 1.6.2
[termux-packages] / packages / termux-api / termux-dialog
CommitLineData
cc1ae02e 1#!/bin/sh
59f0d218
FF
2set -e -u
3
0ec2b704 4SCRIPTNAME=termux-dialog
59f0d218 5show_usage () {
0ec2b704
FF
6 echo "Usage: $SCRIPTNAME [OPTIONS]"
7 echo "Show a text entry dialog."
8 echo ""
8d6e165f
FF
9 echo " -i <hint> the input hint to show when the input is empty"
10 echo " -m use a textarea with multiple lines instead of a single"
11 echo " -p enter the input as a password"
12 echo " -t <title> the title to show for the input prompt"
0ec2b704 13 exit 0
59f0d218
FF
14}
15
16PARAMS=""
0ec2b704
FF
17
18ARG_I=""
19OPT_I=""
20ARG_M=""
21ARG_P=""
22ARG_T=""
23OPT_T=""
24
25while getopts :hi:mpt: option
26do
27 case "$option" in
28 h) show_usage;;
29 i) ARG_I="--es input_hint"; OPT_I="$OPTARG";;
30 m) ARG_M="--ez multiple_lines true";;
31 p) ARG_P="--es input_type password";;
32 t) ARG_T="--es input_title"; OPT_T="$OPTARG";;
33 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
34 esac
59f0d218 35done
0ec2b704 36shift $(($OPTIND-1))
59f0d218 37
0ec2b704 38if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
59f0d218 39
8d6e165f
FF
40set -- $ARG_M $ARG_P
41if [ -n "$ARG_I" ]; then set -- "$@" $ARG_I "$OPT_I"; fi
42if [ -n "$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi
43
44@TERMUX_API@ Dialog "$@"