Last active
July 1, 2021 17:15
-
-
Save eebmagic/dd433c6647a0a5e104065082c6be4adc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
remote = os.popen('git remote show').read() | |
if not remote: | |
quit() | |
response = os.popen(f'git remote show {remote}').read() | |
for line in response.split('\n'): | |
if 'http' in line or '.com' in line: | |
link = line.split(' ')[-1].strip() | |
if link.startswith('http') | |
command = f'open {link}' | |
print(f'opening link:\n\t{link}') | |
os.system(command) | |
quit() | |
elif 'git@' in link: | |
link = link.replace(':', '/') | |
link = link.replace('git@', 'http://') | |
command = f'open {link}' | |
print(f'opening link:\n\t{link}') | |
os.system(command) | |
quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment