termux-packages/packages/termux-api/termux-vibrate

29 lines
652 B
Plaintext
Raw Normal View History

#!/bin/sh
2015-06-13 01:03:31 +02:00
set -e -u
2016-04-20 01:00:08 +02:00
SCRIPTNAME=termux-vibrate
2015-06-13 01:03:31 +02:00
show_usage () {
echo "Usage: $SCRIPTNAME [-d duration] [-f]"
echo "Vibrate the device."
echo " -d duration the duration to vibrate in ms (default:1000)"
echo " -f force vibration even in silent mode"
exit 0
2015-06-13 01:03:31 +02:00
}
2016-04-20 01:00:08 +02:00
PARAMS=""
while getopts :hfd: option
do
case "$option" in
h) show_usage;;
d) PARAMS="$PARAMS --ei duration_ms $OPTARG";;
f) PARAMS="$PARAMS --ez force true";;
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
esac
2015-06-13 01:03:31 +02:00
done
2016-04-20 01:00:08 +02:00
shift $(($OPTIND-1))
if [ $# != 0 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
2015-06-13 01:03:31 +02:00
2016-04-20 01:00:08 +02:00
@TERMUX_API@ Vibrate $PARAMS