You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

#!/bin/sh
10 years ago
set -e -u
SCRIPTNAME=$0
show_usage () {
echo "usage: $SCRIPTNAME [OPTIONS]"
echo " Show a text entry dialog."
echo " -i, --input-hint <hint> The input hint to show when the input is empty"
echo " -m, --multiple-lines Use a textarea with multiple lines instead of a single"
echo " -p, --password Enter the input as a password"
echo " -t, --title <title> The title to show for the input prompt"
10 years ago
}
PARAMS=""
O=`busybox getopt -q -l help -l input-hint: -l multiple-lines -l password -l title: -- hi:mpt: "$@"`
10 years ago
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;;
-m|--multiple-lines) PARAMS="$PARAMS --ez multiple_lines true"; shift 1;;
-p|--password) PARAMS="$PARAMS --es input_type password"; shift 1;;
-t|--title) PARAMS="$PARAMS --es input_title '$2'"; shift 2;;
10 years ago
--) shift; break;;
*) echo Error; exit 1;;
esac
done
# Too many arguments:
if [ $# != 0 ]; then show_usage; exit 1; fi
eval @TERMUX_API@ Dialog $PARAMS