mirror of
https://github.com/getsolus/packages.git
synced 2025-04-26 12:50:29 +03:00
worklog.py: Add a -s/--sort option that sorts output (#1724)
**Summary** Without specifying the -s/--sort option, worklog.py will output the latest build or commit last. This enables the ability to trivially keep an eye on large PR (re)builds with something like: while true; do date ./worklog.py --format md builds 2024-02-24 now |tail -n5 echo "----" sleep 30 done **Test Plan** Test the output of worklog.py with and without -s/--sort options. **Checklist** - [ ] Package was built and tested against unstable
This commit is contained in:
commit
bb245a4777
1 changed files with 3 additions and 1 deletions
|
@ -180,6 +180,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument('after', type=str, help='Show builds after this date')
|
||||
parser.add_argument('before', type=str, help='Show builds before this date')
|
||||
parser.add_argument('--format', '-f', type=str, choices=['md', 'tty'], default='tty')
|
||||
parser.add_argument('--sort', '-s', action='store_true', help='Sort packages in lexically ascending order')
|
||||
|
||||
cli_args = parser.parse_args()
|
||||
start = parse_date(cli_args.after)
|
||||
|
@ -196,7 +197,8 @@ if __name__ == '__main__':
|
|||
case 'commits':
|
||||
items = git.commits(start, end)
|
||||
|
||||
items = sorted(items, key=lambda item: (item.package, item.date))
|
||||
if cli_args.sort:
|
||||
items = sorted(items, key=lambda item: (item.package, item.date))
|
||||
|
||||
match cli_args.format:
|
||||
case 'tty':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue