Created
April 17, 2020 09:46
-
-
Save xb4dc0d3/4e87215a49155a22bbd1599d86383790 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/python3 | |
import webbrowser | |
import sys | |
LIST_KELOMPOK = [] | |
# contain all group | |
with open('list_repo.txt') as f: | |
for line in f: | |
if "https" in line: | |
LIST_KELOMPOK.append(line.strip("\n")) | |
# extract no_kelompok to valid gitlab url | |
def extract(args): | |
data = {} | |
for line in LIST_KELOMPOK: | |
no_kelompok, url = line.split(". ") | |
data[int(no_kelompok)] = url | |
print(data[args]) | |
return data[args] | |
# open browser from os | |
def open_browser(url, browser_type='firefox'): | |
browser = webbrowser.get(using=browser_type) | |
browser.open_new_tab(url) | |
def run(): | |
masukkan_nomor_kelompok = int(sys.argv[1]) | |
browser_type = '' | |
if len(sys.argv) > 2: | |
browser_type = sys.argv[2] | |
url_kelompok = extract(masukkan_nomor_kelompok) | |
open_browser(url_kelompok, browser_type) | |
if __name__ == "__main__": | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment