Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from doctorixx/dev
Browse files Browse the repository at this point in the history
Add cli usage
  • Loading branch information
doctorixx authored Aug 11, 2024
2 parents f3b431b + 4e4a390 commit 10efac5
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 18 deletions.
58 changes: 53 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Github Skyline (Alternative) ![](https://img.shields.io/badge/export-stl-blue)
# Github Skyline (Alternative)
![](https://img.shields.io/badge/export-stl-blue)


Alternative of https://skyline.github.com/

Expand All @@ -7,22 +9,38 @@ ___
![](images/render.png "Github skyline render")
___

<!-- TOC -->
* [Github Skyline (Alternative)](#github-skyline-alternative-)
* [Usage](#usage)
* [UI usage](#ui-usage)
* [Windows](#windows)
* [Linux and Mac](#linux-and-mac)
* [CLI usage](#cli-usage)
* [MacOS / Linux](#macos--linux)
* [Windows](#windows-1)
* [Python usage](#python-usage)
* [Compatibility](#compatibility)
* [Developments builds](#developments-builds)
<!-- TOC -->

## Usage

- Go to the latest release and select your platform
![](images/release_assets.png "Github skyline render")
![](images/release_assets.png "Github skyline render")
- Download your system archive
- Unzip archive

### UI usage

#### Windows

### Windows
![](images/windows_open.png "Github skyline render")

- Double-click on downloaded file

![](images/windows_work_example.png "Github skyline render")

### Linux and Mac
#### Linux and Mac

- Run the download binary

Expand All @@ -32,6 +50,25 @@ ___

![](images/linux_run_example.png "Github skyline render")

### CLI usage

(Use same file)

![img.png](images/cli_options.png)

Example:

#### MacOS / Linux

```shell
./skyline-wizard.bin -u doctorixx -y 2024
```

#### Windows

```shell
./skyline-wizard.exe -u doctorixx -y 2024
```

## Python usage

Expand Down Expand Up @@ -76,5 +113,16 @@ Check "*.stl" fies in project root
![](images/stl_file.png "Stl file in explorer")
## Compatibility
(Checked binaries, With Python app works correctly on all platforms)
| OS | x64 | arm64 |
|---------|:---:|:-----:|
| MacOS |||
| Linux |||
| Windows |||
## Developments builds
You can find developments build in GitHub Actions
You can find developments build in GitHub Actions
Binary file added images/cli_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
numpy~=1.24.4
numpy-stl~=3.1.1
requests~=2.32.3
requests~=2.32.3
colorama~=0.4.6
art~=6.2
93 changes: 81 additions & 12 deletions skyline_wizard.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,84 @@
import argparse
from art import tprint
import colorama
from colorama import Back, Fore

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.username
year = parsed.year

if filename is None:
filename = f"{username}-{year}.stl"

process_github_stats(username, year, filename)


def ui_mode():
colorama.init()

print(Fore.BLUE)
tprint("github-skyline")
print(Fore.RESET)

print(Fore.BLACK + Back.MAGENTA, end="")
print("Welcome to github-skyline generator By doctorixx", end="")
print(Fore.RESET + Back.RESET, "\n")

print(Fore.BLACK + Back.WHITE, end="")
print("Enter github username", end="")
print(Fore.RESET + Back.RESET)
username = input("> ")
print()

print(Fore.BLACK + Back.WHITE, end="")
print("Enter year", end="")
print(Fore.RESET + Back.RESET)
year = input("> ")
print()

filename = f"{username}-{year}.stl"
print(Fore.YELLOW, end="")
print("[/] Generation started")
print(Fore.RESET, end="")
process_github_stats(username, year, filename)

print(Fore.GREEN, end="")
print("[+] Generation completed")
print(Fore.RESET, end="")

print(Fore.GREEN, end="")
print(f"[+] Saved to file ", end="")
print(Fore.LIGHTGREEN_EX + Back.RESET, end="")
print(filename, end="")
print(Fore.RESET + Back.RESET)

print(Fore.CYAN, end="")
print("Press enter to exit...")
print(Fore.RESET, end="")

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()

0 comments on commit 10efac5

Please sign in to comment.