2015-08-14 21:27:47 +02:00
|
|
|
#!/bin/sh
|
2015-06-13 01:03:31 +02:00
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
show_usage () {
|
2016-01-12 14:05:17 +01:00
|
|
|
echo 'usage: termux-vibrate [-f,--force] [<duration_ms>]'
|
2015-06-13 01:03:31 +02:00
|
|
|
echo 'Vibrate the device for the specified duration (default:1000 ms).'
|
2016-01-12 14:05:17 +01:00
|
|
|
echo 'By default no vibration is done when in silent mode - use the'
|
|
|
|
echo '-f,--force option to force vibration even when in silent mode.'
|
2015-06-13 01:03:31 +02:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
PARAM_DURATION=""
|
2016-01-12 14:05:17 +01:00
|
|
|
O=`getopt -l duration: -l force -l help -- d:fh "$@"`
|
2015-06-13 01:03:31 +02:00
|
|
|
eval set -- "$O"
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
|
|
|
-d|--duration) PARAM_DURATION="--ei duration_ms $2"; shift 2;;
|
2016-01-12 14:05:17 +01:00
|
|
|
-f|--force) PARAM_DURATION="--ez force true"; shift 1;;
|
2015-06-13 01:03:31 +02:00
|
|
|
-h|--help) show_usage;;
|
|
|
|
--) shift; break;;
|
|
|
|
*) echo Error; exit 1;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2015-08-14 21:27:47 +02:00
|
|
|
@TERMUX_API@ Vibrate $PARAM_DURATION
|