Skip to content

Commit 82ec2e3

Browse files
danogLeonid Plyushch
authored andcommitted
Add title, description, subtitle and cancel text options in termux-fingerprint (#81)
1 parent 48b9273 commit 82ec2e3

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

scripts/termux-fingerprint

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,37 @@ set -e -u
33

44
SCRIPTNAME=termux-fingerprint
55
show_usage () {
6-
echo "Usage: $SCRIPTNAME"
6+
echo "Usage: $SCRIPTNAME [-t title] [-d description] [-s subtitle] [-c cancel]"
77
echo "Use fingerprint sensor on device to check for authentication"
88
echo "NOTE: Only available on Marshmallow and later"
99
exit 0
1010
}
1111

12-
while getopts :h option
12+
ARG_T=""
13+
OPT_T=""
14+
ARG_D=""
15+
OPT_D=""
16+
ARG_S=""
17+
OPT_S=""
18+
ARG_C=""
19+
OPT_C=""
20+
21+
while getopts :ht:d:s:c: option
1322
do
1423
case "$option" in
1524
h) show_usage;;
25+
t) ARG_T="--es title";OPT_T="$OPTARG";;
26+
d) ARG_D="--es description";OPT_D="$OPTARG";;
27+
s) ARG_S="--es subtitle";OPT_S="$OPTARG";;
28+
c) ARG_C="--es cancel";OPT_C="$OPTARG";;
1629
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
1730
esac
1831
done
19-
shift $(($OPTIND-1))
2032

21-
if [ $# -ne 0 ]; then
22-
echo "$SCRIPTNAME takes no arguments"
23-
exit 1
24-
fi
33+
set --
34+
if [ -n "$ARG_T" ]; then set -- "$@" $ARG_T "$OPT_T"; fi
35+
if [ -n "$ARG_D" ]; then set -- "$@" $ARG_D "$OPT_D"; fi
36+
if [ -n "$ARG_S" ]; then set -- "$@" $ARG_S "$OPT_S"; fi
37+
if [ -n "$ARG_C" ]; then set -- "$@" $ARG_C "$OPT_C"; fi
2538

26-
/data/data/com.termux/files/usr/libexec/termux-api Fingerprint
39+
/data/data/com.termux/files/usr/libexec/termux-api Fingerprint "$@"

0 commit comments

Comments
 (0)