This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,50 @@ | ||
import argparse | ||
|
||
from core import process_github_stats | ||
|
||
print("Welcome to github-skyline generator By doctorixx \n") | ||
print("Enter github username") | ||
username = input("> ") # CHANGE TO YOUR USERNAME | ||
print("Enter year") | ||
year = input("> ") # CHANGE TO YOUR YEAR | ||
filename = f"{username}-{year}.stl" # <- Generated filename | ||
print("[/] Generation started") | ||
process_github_stats(username, year, filename) | ||
print("[+] Generation completed") | ||
print(f"[+] Saved to file {filename}") | ||
print("Press enter to exit...") | ||
input() | ||
parser = argparse.ArgumentParser( | ||
prog='skyline_wizard', | ||
description='Utility to generate 3d github skylines models', | ||
epilog='by Doctorixx(https://github.com/doctorixx)') | ||
|
||
parser.add_argument('-f', '--filename', dest="filename") | ||
parser.add_argument('-u', '--username', dest="username") | ||
parser.add_argument('-y', '--year', dest="year") | ||
|
||
|
||
def cli_mode(parsed): | ||
filename = parsed.filename | ||
username = parsed.nickname | ||
year = parsed.year | ||
|
||
if filename is None: | ||
filename = f"{username}-{year}.stl" | ||
|
||
process_github_stats(username, year, filename) | ||
|
||
|
||
def ui_mode(): | ||
print("Welcome to github-skyline generator By doctorixx \n") | ||
print("Enter github username") | ||
username = input("> ") | ||
print("Enter year") | ||
year = input("> ") | ||
filename = f"{username}-{year}.stl" | ||
print("[/] Generation started") | ||
process_github_stats(username, year, filename) | ||
print("[+] Generation completed") | ||
print(f"[+] Saved to file {filename}") | ||
print("Press enter to exit...") | ||
input() | ||
|
||
|
||
if __name__ == '__main__': | ||
parsed = parser.parse_args() | ||
used_cli_attrs = any( | ||
map(lambda attr: parsed.__getattribute__(attr), filter(lambda x: not x.startswith("_"), dir(parsed))) | ||
) | ||
|
||
if used_cli_attrs: | ||
cli_mode(parsed) | ||
else: | ||
ui_mode() |