Skip to content

Instantly share code, notes, and snippets.

@eebmagic
Last active July 1, 2021 17:15
Show Gist options
  • Save eebmagic/dd433c6647a0a5e104065082c6be4adc to your computer and use it in GitHub Desktop.
Save eebmagic/dd433c6647a0a5e104065082c6be4adc to your computer and use it in GitHub Desktop.
#!/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