forked from raycast/script-commands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle-maps.sh
executable file
·27 lines (23 loc) · 922 Bytes
/
google-maps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Search Google Maps
# @raycast.mode silent
# @raycast.packageName Google Maps
# Optional parameters:
# @raycast.icon images/google-map.png
# @raycast.argument1 { "type": "text", "placeholder": "Location", "optional": true}
# @raycast.argument2 { "type": "text", "placeholder": "Destination", "optional": true}
first_argument=${1// /+}
second_argument=${2// /+}
if [ "$1" != "" ]; then
if [ "$2" = "" ]; then
open "https://www.google.com/maps/dir/?api=1&origin=$first_argument"
else
open "https://www.google.com/maps/dir/?api=1&origin=$first_argument&destination=$second_argument"
fi
elif [ "$1" = "" ] && [ "$2" != "" ]; then
open "https://www.google.com/maps/dir/?api=1&origin=Current+Location&destination=$second_argument"
else
open "https://www.google.com/maps"
fi