@@ -167,8 +167,8 @@ def help(rc=0):
167
167
exename = sys .argv [0 ].rsplit ("/" , 1 )[- 1 ]
168
168
print ("%s - Perform remote file operations using MicroPython WebREPL protocol" % exename )
169
169
print ("Arguments:" )
170
- print (" <host>:<remote_file> <local_file> - Copy remote file to local file" )
171
- print (" <local_file> <host>:<remote_file> - Copy local file to remote file" )
170
+ print (" <host>:<remote_file> <local_file> [password] - Copy remote file to local file" )
171
+ print (" <local_file> <host>:<remote_file> [password] - Copy local file to remote file" )
172
172
print ("Examples:" )
173
173
print (" %s script.py 192.168.4.1:/another_name.py" % exename )
174
174
print (" %s script.py 192.168.4.1:/app/" % exename )
@@ -192,7 +192,7 @@ def parse_remote(remote):
192
192
193
193
def main ():
194
194
195
- if len (sys .argv ) != 3 :
195
+ if len (sys .argv ) not in [ 3 , 4 ] :
196
196
help (1 )
197
197
198
198
if ":" in sys .argv [1 ] and ":" in sys .argv [2 ]:
@@ -215,8 +215,14 @@ def main():
215
215
basename = src_file .rsplit ("/" , 1 )[- 1 ]
216
216
dst_file += basename
217
217
218
- if 1 :
219
- print (op , host , port )
218
+ if len (sys .argv ) > 2 :
219
+ passwd = sys .argv [3 ]
220
+ else :
221
+ import getpass
222
+ passwd = getpass .getpass ()
223
+
224
+ if True :
225
+ print (f"op:{ op } , host:{ host } , port:{ port } , passwd:{ passwd } ." )
220
226
print (src_file , "->" , dst_file )
221
227
222
228
s = socket .socket ()
@@ -230,8 +236,6 @@ def main():
230
236
231
237
ws = websocket (s )
232
238
233
- import getpass
234
- passwd = getpass .getpass ()
235
239
login (ws , passwd )
236
240
print ("Remote WebREPL version:" , get_ver (ws ))
237
241
0 commit comments