2015-08-14 21:27:47 +02:00
|
|
|
#!/bin/sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
SCRIPTNAME=$0
|
|
|
|
show_usage () {
|
|
|
|
echo "usage: $SCRIPTNAME [OPTIONS]"
|
|
|
|
echo " Show a text entry dialog."
|
2015-10-27 00:54:49 +01:00
|
|
|
echo " -i, --input-hint <hint> The input hint to show when the input is empty"
|
|
|
|
echo " -p, --password Enter the input as a password"
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PARAMS=""
|
2015-10-27 00:54:49 +01:00
|
|
|
O=`busybox getopt -q -l help -l input-hint: -l password -- hi:p "$@"`
|
2015-06-13 01:03:31 +02:00
|
|
|
if [ $? != 0 ] ; then show_usage; exit 1 ; fi
|
|
|
|
eval set -- "$O"
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-h|--help) show_usage; exit 0;;
|
|
|
|
-i|--input-hint) PARAMS="$PARAMS --es input_hint '$2'"; shift 2;;
|
2015-10-27 00:54:49 +01:00
|
|
|
-p|--password) PARAMS="$PARAMS --es input_type password"; shift 1;;
|
2015-06-13 01:03:31 +02:00
|
|
|
--) shift; break;;
|
|
|
|
*) echo Error; exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Too many arguments:
|
|
|
|
if [ $# != 0 ]; then show_usage; exit 1; fi
|
|
|
|
|
2015-08-14 21:27:47 +02:00
|
|
|
eval @TERMUX_API@ Dialog $PARAMS
|