X-Git-Url: https://git.distorted.org.uk/~mdw/termux-packages/blobdiff_plain/0ec2b70462bf2052dd2080460112c3a8fc87f62e..c2c270c5db6879060d26f9e672e1045ded5d0ba3:/packages/termux-api/termux-dialog diff --git a/packages/termux-api/termux-dialog b/packages/termux-api/termux-dialog index d9684533..2a244464 100755 --- a/packages/termux-api/termux-dialog +++ b/packages/termux-api/termux-dialog @@ -3,14 +3,15 @@ set -e -u SCRIPTNAME=termux-dialog show_usage () { - echo "Usage: $SCRIPTNAME [OPTIONS]" - echo "Show a text entry dialog." - echo "" - echo " -i The input hint to show when the input is empty" - echo " -m Use a textarea with multiple lines instead of a single" - echo " -p Enter the input as a password" - echo " -t The title to show for the input prompt" - exit 0 + echo "Usage: $SCRIPTNAME [-i hint] [-m] [-p] [-t title]" + echo "Show a text entry dialog." + echo "" + echo " -i hint the input hint to show when the input is empty" + echo " -m use a textarea with multiple lines instead of a single" + echo " -p enter the input as a password" + echo " -t title the title to show for the input prompt" + echo "" + exit 0 } PARAMS="" @@ -37,4 +38,8 @@ shift $(($OPTIND-1)) if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi -@TERMUX_API@ Dialog $ARG_I "$OPT_I" $ARG_M $ARG_P $ARG_T "$OPT_T" +set -- $ARG_M $ARG_P +if [ -n "$ARG_I" ]; then set -- "$@" $ARG_I "$OPT_I"; fi +if [ -n "$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi + +@TERMUX_API@ Dialog "$@"