Read [tui] section to preserve BC

This commit is contained in:
Ivan Habunek 2023-12-26 09:48:31 +01:00
parent 9f0c94bce1
commit 11bc102cc8
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
1 changed files with 9 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from click.testing import Result
from functools import wraps
from toot import App, User, config, __version__
from toot.settings import get_settings
from toot.output import print_warning
if t.TYPE_CHECKING:
import typing_extensions as te
@ -47,6 +48,14 @@ def get_default_map():
settings = get_settings()
common = settings.get("common", {})
commands = settings.get("commands", {})
# TODO: remove in version 1.0
tui_old = settings.get("tui", {})
if tui_old:
print_warning("Settings section [tui] has been deprecated in favour of [commands.tui].")
tui_new = commands.get("tui", {})
commands["tui"] = {**tui_old, **tui_new}
return {**common, **commands}