From 42a322a32fbd29f1f93f570dfa87c2882e6e8b41 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Fri, 27 Jan 2023 15:51:21 +0000 Subject: [PATCH] add help on account cmds --- openbb_terminal/account/account_controller.py | 60 ++++++++++++------- openbb_terminal/terminal_controller.py | 12 ++-- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/openbb_terminal/account/account_controller.py b/openbb_terminal/account/account_controller.py index cb22b773b97..8d71b1ee9a0 100644 --- a/openbb_terminal/account/account_controller.py +++ b/openbb_terminal/account/account_controller.py @@ -76,8 +76,8 @@ class AccountController(BaseController): parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, - prog="load", - description="Load your portfolio transactions.", + prog="sync", + description="Turn on/off the automatic sending of configurations when changed.", ) parser.add_argument( "--on", @@ -118,30 +118,46 @@ class AccountController(BaseController): def call_pull(self, _): """Pull data""" - response = Hub.fetch_user_configs(User.get_session()) - if response: - console.print("Remote data:", style="info") - console.print(json.loads(response.content)) - i = console.input( - "\nDo you want to overwrite your local configurations " - "with the remote? (y/n): " - ) - if i.lower() in ["y", "yes"]: - console.print("[green]\nApplied remote configs.[/green]") - else: - console.print("\nAborted.", style="info") + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="pull", + description="Pull and apply stored configurations from the cloud.", + ) + ns_parser = self.parse_simple_args(parser, _) + 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)) + i = console.input( + "\nDo you want to overwrite your local configurations " + "with the remote? (y/n): " + ) + if i.lower() in ["y", "yes"]: + console.print("[green]\nApplied remote configs.[/green]") + else: + console.print("\nAborted.", style="info") def call_clear(self, _): """Clear data""" - i = console.input( - "[red]This action is irreversible!\n" - "Are you sure you want to permanently delete your data? (y/n): [/red]" + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="clear", + description="Clear stored configurations from the cloud.", ) - if i.lower() in ["y", "yes"]: - console.print("") - Hub.clear_user_configs() - else: - console.print("\nAborted.", style="info") + ns_parser = self.parse_simple_args(parser, _) + if ns_parser: + i = console.input( + "[red]This action is irreversible!\n" + "Are you sure you want to permanently delete your data? (y/n): [/red]" + ) + if i.lower() in ["y", "yes"]: + console.print("") + Hub.clear_user_configs() + else: + console.print("\nAborted.", style="info") # @log_start_end(log=logger) # def call_upload(self, other_args: List[str]): diff --git a/openbb_terminal/terminal_controller.py b/openbb_terminal/terminal_controller.py index 6beefded465..3d8d85ca0f8 100644 --- a/openbb_terminal/terminal_controller.py +++ b/openbb_terminal/terminal_controller.py @@ -360,12 +360,12 @@ class TerminalController(BaseController): """Process account command.""" from openbb_terminal.account.account_controller import AccountController - if User.is_guest(): - console.print( - "[info]You need to be logged in to use this menu.\n" - "Create an account here https://my.openbb.co/register.[/info]\n" - ) - return + # if User.is_guest(): + # console.print( + # "[info]You need to be logged in to use this menu.\n" + # "Create an account here https://my.openbb.co/register.[/info]\n" + # ) + # return self.queue = self.load_class(AccountController, self.queue) def call_keys(self, _):