Add title, description, subtitle and cancel text options in the fingerprint script

This commit is contained in:
Daniil Gentili 2019-08-18 15:00:37 +02:00
parent 4c53f71dd5
commit fa5b52da78

View File

@ -3,24 +3,37 @@ set -e -u
SCRIPTNAME=termux-fingerprint
show_usage () {
echo "Usage: $SCRIPTNAME"
echo "Usage: $SCRIPTNAME [-t title] [-d description] [-s subtitle] [-c cancel]"
echo "Use fingerprint sensor on device to check for authentication"
echo "NOTE: Only available on Marshmallow and later"
exit 0
}
while getopts :h option
ARG_T=""
OPT_T=""
ARG_D=""
OPT_D=""
ARG_S=""
OPT_S=""
ARG_C=""
OPT_C=""
while getopts :ht:d:s:c: option
do
case "$option" in
h) show_usage;;
t) ARG_T="--es title";OPT_T="$OPTARG";;
d) ARG_D="--es description";OPT_D="$OPTARG";;
s) ARG_S="--es subtitle";OPT_S="$OPTARG";;
c) ARG_C="--es cancel";OPT_C="$OPTARG";;
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
esac
done
shift $(($OPTIND-1))
if [ $# -ne 0 ]; then
echo "$SCRIPTNAME takes no arguments"
exit 1
fi
set --
if [ -n "$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi
if [ -n "$ARG_D" ]; then set -- "$@" $ARG_D "$OPT_D"; fi
if [ -n "$ARG_S" ]; then set -- "$@" $ARG_S "$OPT_S"; fi
if [ -n "$ARG_C" ]; then set -- "$@" $ARG_C "$OPT_C"; fi
/data/data/com.termux/files/usr/libexec/termux-api Fingerprint
/data/data/com.termux/files/usr/libexec/termux-api Fingerprint "$@"