add help to settings cmds

This commit is contained in:
Diogo Sousa
2023-02-06 10:14:35 +00:00
parent 01706566b0
commit a14cd9c3a0
2 changed files with 48 additions and 20 deletions

View File

@@ -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]):

View File

@@ -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()