Skip to content

Commit 51fcf2c

Browse files
committed
added logo and refactor print style
1 parent 84d3dc9 commit 51fcf2c

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

github-artist.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import subprocess, sys, os
33
from datetime import date, timedelta, datetime
44
from letters import stringToMatrix
5+
from logo import logo
56

67
def add_random_letter_to_file(repo, file_name):
78
command = f'cd {repo} && echo "a" >> {file_name}'
@@ -22,7 +23,10 @@ def make_commit_with_specified_date(repo, date, commit_message = None):
2223

2324
def git_push_to_remote_repo(repo):
2425
command = f"cd {repo} && git push"
25-
subprocess.call(command, shell=True, stdout=subprocess.DEVNULL)
26+
print(f"Pushing...", end="\r")
27+
subprocess.call(command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
28+
print(f"Pushed successfully!")
29+
print("-" * 70)
2630

2731
def clone_repo_if_not_exists_already(username, repo, protocol = "ssh"):
2832
if protocol == "ssh":
@@ -31,7 +35,7 @@ def clone_repo_if_not_exists_already(username, repo, protocol = "ssh"):
3135
command = f"git clone https://github.com/{username}/{repo}.git"
3236

3337
if not os.path.exists(repo):
34-
subprocess.call(command, shell=True, stdout=subprocess.DEVNULL)
38+
subprocess.call(command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
3539

3640

3741

@@ -43,7 +47,7 @@ def execute(repo, date, numbers_of_commits_per_day = 1):
4347
print(f"Number of dates: {len(dates)}")
4448
print(f"Number of commits per day: {numbers_of_commits_per_day}")
4549
print(f"Number of commits: {total_commits}")
46-
print("-" * 50)
50+
print("-" * 70)
4751
for date in dates:
4852
for i in range(numbers_of_commits_per_day):
4953
start_time = datetime.now()
@@ -56,6 +60,7 @@ def execute(repo, date, numbers_of_commits_per_day = 1):
5660
percentage = (commits / total_commits) * 100
5761
print(f"Status: Commits: {commits} -- {percentage:.2f}% -- ETA: {formatted_eta}", end="\r")
5862
print(f"Commits: {commits} -- 100%")
63+
print("-" * 70)
5964

6065
if __name__ == "__main__":
6166

@@ -81,10 +86,14 @@ def execute(repo, date, numbers_of_commits_per_day = 1):
8186

8287

8388
# Start
84-
print("-" * 50)
89+
print("-" * 70)
90+
print(logo)
91+
print("-" * 70)
8592
print(f"Starting write {message} to {username}'s github history.")
8693
print(f"Using repo: {username}/{repo}")
87-
print("-" * 50)
94+
print("-" * 70)
8895
clone_repo_if_not_exists_already(username, repo)
8996
execute(repo, dates, number_of_commits_per_day)
90-
git_push_to_remote_repo(repo)
97+
git_push_to_remote_repo(repo)
98+
print("Art completed")
99+
print("-" * 70)

logo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
logo = """ _ _ _ _ _ _ _
2+
(_) | | | | | | | (_) | |
3+
__ _ _| |_| |__ _ _| |__ ______ __ _ _ __| |_ _ ___| |_
4+
/ _` | | __| '_ \| | | | '_ \ |______| / _` | '__| __| / __| __|
5+
| (_| | | |_| | | | |_| | |_) | | (_| | | | |_| \__ \ |_
6+
\__, |_|\__|_| |_|\__,_|_.__/ \__,_|_| \__|_|___/\__|
7+
__/ |
8+
|___/ """

0 commit comments

Comments
 (0)