Skip to content

Commit ad8d9ac

Browse files
authored
Add map_it script
1 parent 689dc22 commit ad8d9ac

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

map_it.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
# Launches a map in the browser using an address from the command line or clipboard.
3+
4+
import webbrowser
5+
import sys
6+
7+
import pyperclip # pip install pyperclip
8+
9+
10+
def map_it():
11+
if len(sys.argv) > 1:
12+
# get address from command line
13+
address = ' '.join(sys.argv[1:])
14+
else:
15+
# get address from clipboard
16+
address = pyperclip.paste()
17+
18+
webbrowser.open('https://www.google.com/maps/place/' + address)
19+
20+
if __name__ == '__main__':
21+
map_it()

0 commit comments

Comments
 (0)