mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-07 01:41:17 +00:00
pull command output
This commit is contained in:
@@ -13,7 +13,9 @@ from openbb_terminal.core.config.paths import USER_ROUTINES_DIRECTORY
|
||||
from openbb_terminal import feature_flags as obbff
|
||||
from openbb_terminal.menu import session
|
||||
from openbb_terminal.session import hub_model as Hub
|
||||
from openbb_terminal.session import local_model as Local
|
||||
from openbb_terminal.session.user import User
|
||||
from openbb_terminal.account.account_model import show_diff
|
||||
|
||||
# from openbb_terminal.session.user import User
|
||||
|
||||
@@ -128,14 +130,16 @@ class AccountController(BaseController):
|
||||
if ns_parser:
|
||||
response = Hub.fetch_user_configs(User.get_session())
|
||||
if response:
|
||||
console.print("Remote data:", style="info")
|
||||
console.print(json.loads(response.content))
|
||||
configs = json.loads(response.content)
|
||||
show_diff(configs=configs)
|
||||
|
||||
i = console.input(
|
||||
"\nDo you want to overwrite your local configurations "
|
||||
"with the remote? (y/n): "
|
||||
"with the above? (y/n): "
|
||||
)
|
||||
if i.lower() in ["y", "yes"]:
|
||||
console.print("[green]\nApplied remote configs.[/green]")
|
||||
Local.apply_configs(configs=configs)
|
||||
console.print("\nDone.", style="info")
|
||||
else:
|
||||
console.print("\nAborted.", style="info")
|
||||
|
||||
|
||||
27
openbb_terminal/account/account_model.py
Normal file
27
openbb_terminal/account/account_model.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
|
||||
def show_diff(configs: dict):
|
||||
"""Show the diff between the local and remote configs.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
configs : dict
|
||||
The configs.
|
||||
"""
|
||||
if configs:
|
||||
settings = configs.get("features_settings", {})
|
||||
keys = configs.get("features_keys", {})
|
||||
|
||||
if settings:
|
||||
console.print("Settings:", style="info")
|
||||
for k, v in sorted(settings.items()):
|
||||
console.print(f"[menu]{k}[/menu]: {v}")
|
||||
|
||||
if keys:
|
||||
if settings:
|
||||
console.print("")
|
||||
|
||||
console.print("Keys:", style="info")
|
||||
for k, v in sorted(keys.items()):
|
||||
console.print(f"[menu]{k}[/menu]: {v}")
|
||||
4
openbb_terminal/miscellaneous/i18n/en.yml
vendored
4
openbb_terminal/miscellaneous/i18n/en.yml
vendored
@@ -19,8 +19,8 @@ en:
|
||||
_main_menu_: Main menu
|
||||
account/_info_: Cloud storage of keys, settings and feature flags
|
||||
account/sync: Turns the cloud synchronization on/off
|
||||
account/pull: Pull from cloud
|
||||
account/clear: Clear data from remote cloud
|
||||
account/pull: Pull data from cloud
|
||||
account/clear: Clear data from cloud
|
||||
account/_routines_: Routines
|
||||
account/upload: Upload routine
|
||||
account/download: Download routine
|
||||
|
||||
@@ -87,7 +87,7 @@ def apply_configs(configs: dict):
|
||||
configs : dict
|
||||
The configurations.
|
||||
"""
|
||||
console.print(configs, style="red")
|
||||
# console.print(configs, style="red")
|
||||
|
||||
if configs:
|
||||
settings = configs.get("features_settings", {})
|
||||
|
||||
Reference in New Issue
Block a user