1
0
Fork 0

new: allow to specify local name of file when using wasptool pull with argument 'as'

Signed-off-by: olivier-cornelis <klduycea@mailer.me>
This commit is contained in:
olivier-cornelis 2022-09-04 15:56:17 +02:00 committed by Daniel Thompson
parent 6a67d9bf9f
commit ee257d6ade

View file

@ -371,8 +371,8 @@ def handle_upload(c, fname, tname):
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Wasp-os command and control client') description='Wasp-os command and control client')
parser.add_argument('--as', dest='upload_as', default=None, parser.add_argument('--as', dest='file_as', default=None,
help="Filename to use on the target (e.g. wasptool --upload docs/main/chrono.py --as main.py") help="Filename to use on the target (e.g. wasptool --upload docs/main/chrono.py --as main.py. Also works with --pull")
parser.add_argument('--battery', action='store_true', parser.add_argument('--battery', action='store_true',
help="Report remaining battery charge") help="Report remaining battery charge")
parser.add_argument('--bootloader', action='store_true', parser.add_argument('--bootloader', action='store_true',
@ -457,16 +457,19 @@ if __name__ == '__main__':
handle_eval(console, args.eval) handle_eval(console, args.eval)
if args.pull: if args.pull:
handle_binary_download(console, args.pull, args.pull) if args.file_as is None:
handle_binary_download(console, args.pull, args.pull)
else:
handle_binary_download(console, args.pull, args.file_as)
if args.push: if args.push:
handle_binary_upload(console, args.push, args.push) handle_binary_upload(console, args.push, args.push)
if args.upload: if args.upload:
if args.binary: if args.binary:
handle_binary_upload(console, args.upload, args.upload_as) handle_binary_upload(console, args.upload, args.file_as)
else: else:
handle_upload(console, args.upload, args.upload_as) handle_upload(console, args.upload, args.file_as)
if args.memfree: if args.memfree:
handle_memory_free(console) handle_memory_free(console)