Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions git_stalk/stalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,19 @@ def date_time_validate(date_text):
except ValueError:
raise ValueError("Incorrect data format, should be YYYY-MM-DD")


def get_today_date():
return (str(datetime.datetime.now().strftime("%Y-%m-%d")))


def get_contributions(user, latest, org=None):
"""
Traverses the latest array,
creates a table
if org argument is present only the repos which belong to the org is added to the table
and prints the table.
"""
print("Contributions Today: ")
print("Contributions {} :".format(get_today_date()))
if latest:
table = PrettyTable(["Type", "Repository", "Time", "Details"])
for event in latest:
Expand All @@ -139,8 +144,7 @@ def get_contributions(user, latest, org=None):
get_details(event)
])
print(table)
print("{} have made {} public contribution(s) {}.\n".format(
user, str(len(latest)), date_text))
print("{} have made {} public contribution(s) {}.\n".format(user, str(len(latest)), date_text))


def get_other_activity(user, other):
Expand All @@ -150,6 +154,7 @@ def get_other_activity(user, other):
and prints the table.
"""
print("Other Activity {}: ".format(date_text))

if other:
other_table = PrettyTable(["Type", "Repository", "Time", "Details"])
for event in other:
Expand All @@ -160,7 +165,7 @@ def get_other_activity(user, other):
])
print(other_table)
print("{} have done {} other public activit(y/ies) {}.\n".format(user, str(len(other)), date_text))


def display_stars(user, stars):
"""
Expand Down