File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change
1
+ import datetime
1
2
import click
2
3
import json
3
4
import requests
@@ -233,7 +234,8 @@ async def main(file_path: str=None):
233
234
can_push = click .confirm (f"Content of { file } changed. Overwrite?" )
234
235
235
236
if can_push :
236
- click .echo (f"Push { _real_file } " )
237
+ date = datetime .datetime .now ().strftime ("%H:%M:%S" )
238
+ click .echo (f"{ date if watch else "" } Push { _real_file } " )
237
239
await tree .edit (_type , entry ["key" ], {
238
240
"script" : file_content
239
241
})
@@ -299,15 +301,18 @@ def watch_loop():
299
301
import time
300
302
modified_files = {}
301
303
def on_modified (event ):
302
- # check for tmp file
303
- if event .src_path .endswith ("~" ):
304
- return
305
- if event .src_path not in modified_files :
304
+ try :
305
+ # check for tmp file
306
+ if event .src_path .endswith ("~" ):
307
+ return
308
+ if event .src_path not in modified_files :
309
+ modified_files [event .src_path ] = os .path .getmtime (event .src_path )
310
+ elif os .path .getmtime (event .src_path ) == modified_files [event .src_path ]:
311
+ return
306
312
modified_files [event .src_path ] = os .path .getmtime (event .src_path )
307
- elif os .path .getmtime (event .src_path ) == modified_files [event .src_path ]:
308
- return
309
- modified_files [event .src_path ] = os .path .getmtime (event .src_path )
310
- asyncio .new_event_loop ().run_until_complete (main (event .src_path ))
313
+ asyncio .new_event_loop ().run_until_complete (main (event .src_path ))
314
+ except Exception as e :
315
+ print (f"Error: on file { event .src_path } { e } " )
311
316
312
317
313
318
regexes = [r".*\.py" ]
You can’t perform that action at this time.
0 commit comments