Upgrade scaffolding

This commit is contained in:
Manuel Ebert 2014-08-04 17:19:15 +02:00
parent 09b94d1047
commit 51a6ac2d51
3 changed files with 30 additions and 9 deletions

17
jrnl/upgrade.py Normal file
View file

@ -0,0 +1,17 @@
def upgrade_jrnl_if_necessary(config_path):
with open(config_path) as f:
config = f.read()
if not config.strip().startswith("{"):
return
util.prompt("Welcome to jrnl {}".format(__version__))
util.prompt("jrnl will now upgrade your configuration and journal files.")
util.prompt("Please note that jrnl 1.x is NOT forward compatible with this version of jrnl.")
util.prompt("If you choose to proceed, you will not be able to use your journals with")
util.prompt("older versions of jrnl anymore.")
cont = util.yesno("Continue upgrading jrnl?", default=False)
if not cont:
util.prompt("jrnl NOT upgraded, exiting.")
sys.exit(1)
util.prompt("")