Commit | Line | Data |
---|---|---|
cc1ae02e | 1 | #!/bin/sh |
59f0d218 FF |
2 | |
3 | set -e -u | |
4 | ||
5 | SCRIPTNAME=$0 | |
6 | show_usage () { | |
7 | echo "usage: $SCRIPTNAME [OPTIONS]" | |
8 | echo " Show a text entry dialog." | |
abe8a8de | 9 | echo " -i, --input-hint <hint> The input hint to show when the input is empty" |
2810eedb | 10 | echo " -m, --multiple-lines Use a textarea with multiple lines instead of a single" |
abe8a8de | 11 | echo " -p, --password Enter the input as a password" |
2810eedb | 12 | echo " -t, --title <title> The title to show for the input prompt" |
59f0d218 FF |
13 | } |
14 | ||
15 | PARAMS="" | |
2810eedb | 16 | O=`busybox getopt -q -l help -l input-hint: -l multiple-lines -l password -l title: -- hi:mpt: "$@"` |
59f0d218 FF |
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;; | |
2810eedb | 23 | -m|--multiple-lines) PARAMS="$PARAMS --ez multiple_lines true"; shift 1;; |
abe8a8de | 24 | -p|--password) PARAMS="$PARAMS --es input_type password"; shift 1;; |
2810eedb | 25 | -t|--title) PARAMS="$PARAMS --es input_title '$2'"; shift 2;; |
59f0d218 FF |
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 | ||
cc1ae02e | 34 | eval @TERMUX_API@ Dialog $PARAMS |