Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort output alphabetically by default #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
8 changes: 5 additions & 3 deletions libyear/libyear
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def main():
pt = PrettyTable()
pt.field_names = ['Library', 'Current Version', 'Latest Version', 'Libyears behind']
total_days = 0

for req in requirements:
name, version, version_lt = get_requirement_name_and_version(req)
if not name:
continue

if not version and not version_lt:
continue

v, lv, days = get_lib_days(name, version, version_lt)
if v and days > 0:
pt.add_row([name, v, lv, str(round(days / 365, 2))])
Expand All @@ -36,13 +36,15 @@ def main():
if args.sort:
pt.sortby = 'Libyears behind'
pt.reversesort = True
else:
pt.sortby = 'Library'

if total_days == 0:
print("Your system is up-to-date!")
else:
print(pt)
print("Your system is %s libyears behind" % str(round(total_days / 365, 2)))



if __name__ == "__main__":
Expand Down