Skip to content

Commit 4b0811a

Browse files
Merge pull request #972 from cstadler333/patch-1
allow only second argument
2 parents 71d5c85 + 62522c6 commit 4b0811a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

commands/web-searches/google-maps.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
first_argument=${1// /+}
1515
second_argument=${2// /+}
1616

17-
if [ "$1" = "" ]; then
18-
open "https://www.google.com/maps"
19-
elif [ "$2" = "" ]; then
20-
open "https://www.google.com/maps/search/$first_argument"
17+
if [ "$1" != "" ]; then
18+
if [ "$2" = "" ]; then
19+
open "https://www.google.com/maps/dir/?api=1&origin=$first_argument"
20+
else
21+
open "https://www.google.com/maps/dir/?api=1&origin=$first_argument&destination=$second_argument"
22+
fi
23+
elif [ "$1" = "" ] && [ "$2" != "" ]; then
24+
open "https://www.google.com/maps/dir/?api=1&origin=Current+Location&destination=$second_argument"
2125
else
22-
open "https://www.google.com/maps/dir/$first_argument/$second_argument"
26+
open "https://www.google.com/maps"
2327
fi

0 commit comments

Comments
 (0)