From 80458897aa01c77255b1003066be4a6211467d01 Mon Sep 17 00:00:00 2001 From: Matheus Cansian Date: Sun, 13 Mar 2022 19:18:42 -0300 Subject: [PATCH 1/2] Add --oldest-first argument and reverse default order --- antfs_cli/program.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/antfs_cli/program.py b/antfs_cli/program.py index d24d3e1..e0703c8 100755 --- a/antfs_cli/program.py +++ b/antfs_cli/program.py @@ -150,6 +150,7 @@ def __init__(self, config_dir, args): self._uploading = args.upload self._pair = args.pair self._skip_archived = args.skip_archived + self._oldest_first = args.oldest_first def setup_channel(self, channel): channel.set_period(4096) @@ -245,6 +246,9 @@ def on_transport(self, beacon): if self._skip_archived: downloading = [fil for fil in downloading if not fil.is_archived()] + if not self._oldest_first: + downloading = list(reversed(downloading)) + print("Downloading", len(downloading), "file(s)") if self._uploading: print(" and uploading", len(uploading), "file(s)") @@ -348,6 +352,9 @@ def main(): action="store_true", help="don't download files marked as 'archived' on the watch", ) + parser.add_argument( + "--oldest-first", action="store_true", + help="download the oldest activities first") args = parser.parse_args() # Set up config dir From b8e2b78f50d0bb400edfcd4906c5eec898e92c5e Mon Sep 17 00:00:00 2001 From: Matheus Cansian Date: Sun, 13 Mar 2022 19:49:22 -0300 Subject: [PATCH 2/2] Fix linter --- antfs_cli/program.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/antfs_cli/program.py b/antfs_cli/program.py index e0703c8..086d30c 100755 --- a/antfs_cli/program.py +++ b/antfs_cli/program.py @@ -353,8 +353,10 @@ def main(): help="don't download files marked as 'archived' on the watch", ) parser.add_argument( - "--oldest-first", action="store_true", - help="download the oldest activities first") + "--oldest-first", + action="store_true", + help="download the oldest activities first", + ) args = parser.parse_args() # Set up config dir