check, with edit option: ask to check if changes

This commit is contained in:
Cyrille L 2023-02-07 15:16:55 +01:00
parent fab895ec6b
commit 6a9ef0ed67
2 changed files with 16 additions and 2 deletions

View File

@ -38,13 +38,27 @@ def manage_check(target, option):
# Manage option
#--------------
if option == 'Edit':
curr_hash = tyto.get_filesum(db.uri_file, True)
tyto.edit_file(db.uri_file)
return
new_hash = tyto.get_filesum(db.uri_file, True)
if curr_hash != new_hash:
ask = ''
try:
ask = input('-> Check your changes ? ')
except KeyboardInterrupt:
print('')
logs.out("255", '', True)
if not ask in ['y', 'Y']:
logs.out("255", '', True)
else:
option = 'Force'
elif option == 'Show':
article_raw = open(db.uri_file).read()
for line in article_raw.rsplit('\n'):
print(line)
return
# Just read the DB from command
elif option == 'DB':
if db.db_exists:

View File

@ -194,8 +194,8 @@ def create_main_page(target, article_bottom):
def create_html_infos_section(process):
# Need to reload the DB to get last time updated
exec(open(db.post_db).read(), globals())
global post_pub
global post_pub
if process == 'wip':
date_raw = date_wip # <time datetime=
date_pub = date_wip.rsplit(' ')[0]