Browse Source

termux-api: Fix typo in termux-location

Closes #253.
android-5
Fredrik Fornwall 9 years ago
parent
commit
b2d955fc19
  1. 2
      packages/termux-api/build.sh
  2. 26
      packages/termux-api/termux-location

2
packages/termux-api/build.sh

@ -1,6 +1,6 @@
TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/
TERMUX_PKG_DESCRIPTION="Termux API commands"
TERMUX_PKG_VERSION=0.18
TERMUX_PKG_VERSION=0.19
termux_step_make_install () {
mkdir -p $TERMUX_PREFIX/bin

26
packages/termux-api/termux-location

@ -1,7 +1,7 @@
#!/bin/sh
set -e -u
SCRIPTNAME=termux-notification
SCRIPTNAME=termux-location
show_usage () {
echo "usage: $SCRIPTNAME [-p provider] [-r request]"
echo "Get the device location."
@ -12,14 +12,34 @@ show_usage () {
exit 0
}
validate_provider () {
PROVIDER=$1
case "$PROVIDER" in
gps) ;;
network) ;;
passive) ;;
*) echo "$SCRIPTNAME: Unsupported provider: '$PROVIDER'"; exit 1;;
esac
}
validate_request () {
REQUEST=$1
case "$REQUEST" in
once) ;;
last) ;;
updates) ;;
*) echo "$SCRIPTNAME: Unsupported request: '$REQUEST'"; exit 1;;
esac
}
PARAMS=""
while getopts :hr:p: option
do
case "$option" in
h) show_usage;;
r) PARAMS="$PARAMS --es request $OPTARG";;
p) PARAMS="$PARAMS --es provider $OPTARG";;
r) validate_request $OPTARG; PARAMS="$PARAMS --es request $OPTARG";;
p) validate_provider $OPTARG; PARAMS="$PARAMS --es provider $OPTARG";;
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
esac
done

Loading…
Cancel
Save