From fa5b52da7823a73214b33a6f076aaa195615a87f Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 18 Aug 2019 15:00:37 +0200 Subject: [PATCH] Add title, description, subtitle and cancel text options in the fingerprint script --- scripts/termux-fingerprint | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/scripts/termux-fingerprint b/scripts/termux-fingerprint index 48d421b..5ceb69b 100755 --- a/scripts/termux-fingerprint +++ b/scripts/termux-fingerprint @@ -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 "$@" \ No newline at end of file