diff --git a/openbb_terminal/settings_controller.py b/openbb_terminal/settings_controller.py index 2fbdcacb210..8129efce514 100644 --- a/openbb_terminal/settings_controller.py +++ b/openbb_terminal/settings_controller.py @@ -226,26 +226,42 @@ class SettingsController(BaseController): ) @log_start_end(log=logger) - def call_colors(self, _): + def call_colors(self, other_args: List[str]): """Process colors command""" - console.print( - "\n1. Play with the terminal coloring embedded in our website https://openbb.co/customize\n" + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="autoscaling", + description="Set the use of autoscaling in the plots", ) - console.print("2. Once happy, click 'Download Theme'\n") - console.print( - "3. The file 'openbb_config.richstyle.json' should be downloaded\n" - ) - console.print( - "4. Insert that config file inside /OpenBBUserData/styles/user/\n" - ) - console.print("5. Close the terminal and run it again.\n") + ns_parser = self.parse_simple_args(parser, other_args) + if ns_parser: + console.print( + "\n1. Play with the terminal coloring embedded in our website https://openbb.co/customize\n" + ) + console.print("2. Once happy, click 'Download Theme'\n") + console.print( + "3. The file 'openbb_config.richstyle.json' should be downloaded\n" + ) + console.print( + "4. Insert that config file inside /OpenBBUserData/styles/user/\n" + ) + console.print("5. Close the terminal and run it again.\n") @log_start_end(log=logger) - def call_dt(self, _): + def call_dt(self, other_args: List[str]): """Process dt command""" - obbff_ctrl.FeatureFlagsController.set_feature_flag( - "OPENBB_USE_DATETIME", not obbff.USE_DATETIME + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="dt", + description="Set the use of datetime in the plots", ) + ns_parser = self.parse_simple_args(parser, other_args) + if ns_parser: + obbff_ctrl.FeatureFlagsController.set_feature_flag( + "OPENBB_USE_DATETIME", not obbff.USE_DATETIME + ) @log_start_end(log=logger) def call_source(self, other_args: List[str]): @@ -283,11 +299,19 @@ class SettingsController(BaseController): console.print(e) @log_start_end(log=logger) - def call_autoscaling(self, _): + def call_autoscaling(self, other_args: List[str]): """Process autoscaling command""" - obbff_ctrl.FeatureFlagsController.set_feature_flag( - "OPENBB_USE_PLOT_AUTOSCALING", not obbff.USE_PLOT_AUTOSCALING + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="autoscaling", + description="Set the use of autoscaling in the plots", ) + ns_parser = self.parse_simple_args(parser, other_args) + if ns_parser: + obbff_ctrl.FeatureFlagsController.set_feature_flag( + "OPENBB_USE_PLOT_AUTOSCALING", not obbff.USE_PLOT_AUTOSCALING + ) @log_start_end(log=logger) def call_dpi(self, other_args: List[str]): diff --git a/tests/openbb_terminal/test_settings_controller.py b/tests/openbb_terminal/test_settings_controller.py index e7c552d36e0..01b6c13b8b0 100644 --- a/tests/openbb_terminal/test_settings_controller.py +++ b/tests/openbb_terminal/test_settings_controller.py @@ -12,9 +12,13 @@ def controller(mocker): True, ) mocker.patch("openbb_terminal.settings_controller.session", True) - mocker.patch("openbb_terminal.settings_controller.set_cfg_plot") - mocker.patch("openbb_terminal.settings_controller.set_path_config") - mocker.patch("openbb_terminal.settings_controller.obbff_ctrl") + mocker.patch("openbb_terminal.settings_controller.SettingsController.set_cfg_plot") + mocker.patch( + "openbb_terminal.settings_controller.SettingsController.set_path_config" + ) + mocker.patch( + "openbb_terminal.settings_controller.obbff_ctrl.FeatureFlagsController.set_feature_flag" + ) return SettingsController()