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

added reverse order download and download n options #147

Open
wants to merge 3 commits 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
10 changes: 10 additions & 0 deletions antfs_cli/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def __init__(self, config_dir, args):
self._uploading = args.upload
self._pair = args.pair
self._skip_archived = args.skip_archived
self._newest_first = args.newest_first
self._download_n = args.download_n

def setup_channel(self, channel):
channel.set_period(4096)
Expand Down Expand Up @@ -235,6 +237,12 @@ def on_transport(self, beacon):
for fil in downloading
if not fil.is_archived()]

if self._newest_first:
downloading = downloading[::-1]

if self._download_n:
downloading = downloading[:self._download_n]

print("Downloading", len(downloading), "file(s)")
if self._uploading:
print(" and uploading", len(uploading), "file(s)")
Expand Down Expand Up @@ -321,6 +329,8 @@ def main():
parser.add_argument("--upload", action="store_true", help="enable uploading")
parser.add_argument("--debug", action="store_true", help="enable debug")
parser.add_argument("--pair", action="store_true", help="force pairing even if already paired")
parser.add_argument("-r", "--newest-first", action="store_true", help="download most recent activities")
parser.add_argument("-n", "--download-n", action="store", help="download first n files", type=int, default=None)
parser.add_argument("-a", "--skip-archived", action="store_true", help="don't download files marked as 'archived' on the watch")
args = parser.parse_args()

Expand Down