ruby: Update from 2.2.3 to 2.2.4
[termux-packages] / packages / termux-api / termux-dialog
... / ...
CommitLineData
1#!/bin/sh
2
3set -e -u
4
5SCRIPTNAME=$0
6show_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
15PARAMS=""
16O=`busybox getopt -q -l help -l input-hint: -l multiple-lines -l password -l title: -- hi:mpt: "$@"`
17if [ $? != 0 ] ; then show_usage; exit 1 ; fi
18eval set -- "$O"
19while true; do
20case "$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;;
28esac
29done
30
31# Too many arguments:
32if [ $# != 0 ]; then show_usage; exit 1; fi
33
34eval @TERMUX_API@ Dialog $PARAMS