termux-api: Add termux-vibrate -f/--force option
This commit is contained in:
parent
bfbb91ff40
commit
08d717918a
|
@ -1,6 +1,6 @@
|
||||||
TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/
|
TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/
|
||||||
TERMUX_PKG_DESCRIPTION="Termux API commands"
|
TERMUX_PKG_DESCRIPTION="Termux API commands"
|
||||||
TERMUX_PKG_VERSION=0.11
|
TERMUX_PKG_VERSION=0.12
|
||||||
|
|
||||||
termux_step_make_install () {
|
termux_step_make_install () {
|
||||||
mkdir -p $TERMUX_PREFIX/bin
|
mkdir -p $TERMUX_PREFIX/bin
|
||||||
|
|
|
@ -3,17 +3,20 @@
|
||||||
set -e -u
|
set -e -u
|
||||||
|
|
||||||
show_usage () {
|
show_usage () {
|
||||||
echo 'usage: termux-vibrate [<duration_ms>]'
|
echo 'usage: termux-vibrate [-f,--force] [<duration_ms>]'
|
||||||
echo 'Vibrate the device for the specified duration (default:1000 ms).'
|
echo 'Vibrate the device for the specified duration (default:1000 ms).'
|
||||||
|
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.'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
PARAM_DURATION=""
|
PARAM_DURATION=""
|
||||||
O=`getopt -l duration: -l help -- d:h "$@"`
|
O=`getopt -l duration: -l force -l help -- d:fh "$@"`
|
||||||
eval set -- "$O"
|
eval set -- "$O"
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-d|--duration) PARAM_DURATION="--ei duration_ms $2"; shift 2;;
|
-d|--duration) PARAM_DURATION="--ei duration_ms $2"; shift 2;;
|
||||||
|
-f|--force) PARAM_DURATION="--ez force true"; shift 1;;
|
||||||
-h|--help) show_usage;;
|
-h|--help) show_usage;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
*) echo Error; exit 1;;
|
*) echo Error; exit 1;;
|
||||||
|
|
Loading…
Reference in New Issue