From ee257d6ade1efeecdcf4371d1d72a4e7d7f247ec Mon Sep 17 00:00:00 2001 From: olivier-cornelis Date: Sun, 4 Sep 2022 15:56:17 +0200 Subject: [PATCH] new: allow to specify local name of file when using wasptool pull with argument 'as' Signed-off-by: olivier-cornelis --- tools/wasptool | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/wasptool b/tools/wasptool index 7d9df3e..9c8d944 100755 --- a/tools/wasptool +++ b/tools/wasptool @@ -371,8 +371,8 @@ def handle_upload(c, fname, tname): if __name__ == '__main__': parser = argparse.ArgumentParser( description='Wasp-os command and control client') - parser.add_argument('--as', dest='upload_as', default=None, - help="Filename to use on the target (e.g. wasptool --upload docs/main/chrono.py --as main.py") + 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. Also works with --pull") parser.add_argument('--battery', action='store_true', help="Report remaining battery charge") parser.add_argument('--bootloader', action='store_true', @@ -457,16 +457,19 @@ if __name__ == '__main__': handle_eval(console, args.eval) 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: handle_binary_upload(console, args.push, args.push) if args.upload: if args.binary: - handle_binary_upload(console, args.upload, args.upload_as) + handle_binary_upload(console, args.upload, args.file_as) else: - handle_upload(console, args.upload, args.upload_as) + handle_upload(console, args.upload, args.file_as) if args.memfree: handle_memory_free(console)