termux-api: Add termux-vibrate -f/--force option
[termux-packages] / packages / termux-api / termux-dialog
CommitLineData
cc1ae02e 1#!/bin/sh
59f0d218
FF
2
3set -e -u
4
5SCRIPTNAME=$0
6show_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
15PARAMS=""
2810eedb 16O=`busybox getopt -q -l help -l input-hint: -l multiple-lines -l password -l title: -- hi:mpt: "$@"`
59f0d218
FF
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;;
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;;
28esac
29done
30
31# Too many arguments:
32if [ $# != 0 ]; then show_usage; exit 1; fi
33
cc1ae02e 34eval @TERMUX_API@ Dialog $PARAMS