add command for explicit migration

This commit is contained in:
Jakob Ketterl
2021-04-26 19:27:12 +02:00
parent 159c231884
commit 05985ff46a
3 changed files with 32 additions and 3 deletions

22
owrx/config/commands.py Normal file
View File

@ -0,0 +1,22 @@
from owrx.admin.commands import Command
from owrx.config import Config
from owrx.bookmarks import Bookmarks
class MigrateCommand(Command):
def run(self, args):
print("Migrating configuration...")
config = Config.get()
# a key that is set will end up in the DynamicConfig, so this will transfer everything there
for key, value in config.items():
config[key] = value
config.store()
print("Migrating bookmarks...")
# bookmarks just need to be saved
b = Bookmarks.getSharedInstance()
b.getBookmarks()
b.store()
print("Migration complete!")