diff --git a/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py b/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py index 4d7029a0838..2c84a883959 100644 --- a/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py +++ b/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py @@ -638,6 +638,7 @@ def show_quick_performance( show_index=False, headers=df.columns, title=f"{symbol.upper()}/{current_currency.upper()} Performance {exchange_str}", + print_to_console=True, ) console.print() diff --git a/openbb_terminal/economy/economy_controller.py b/openbb_terminal/economy/economy_controller.py index cc325d3545a..533cecdd0e0 100644 --- a/openbb_terminal/economy/economy_controller.py +++ b/openbb_terminal/economy/economy_controller.py @@ -679,6 +679,10 @@ class EconomyController(BaseController): dest="parameter", default="", help="Series ID of the Macro Economic data from FRED", + required="-h" not in other_args + and "--help" not in other_args + and "-q" not in other_args + and "--query" not in other_args, ) parser.add_argument( "-s", @@ -704,6 +708,10 @@ class EconomyController(BaseController): nargs="+", dest="query", help="Query the FRED database to obtain Series IDs given the query search term.", + required="-h" not in other_args + and "--help" not in other_args + and "-p" not in other_args + and "--parameter" not in other_args, ) if other_args and "-" not in other_args[0][0]: other_args.insert(0, "-p") diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py index 407b932f596..b85d1d9a9c0 100644 --- a/openbb_terminal/helper_funcs.py +++ b/openbb_terminal/helper_funcs.py @@ -273,6 +273,7 @@ def print_rich_table( columns_to_auto_color: Optional[List[str]] = None, rows_to_auto_color: Optional[List[str]] = None, export: bool = False, + print_to_console: bool = False, limit: Optional[int] = 1000, ): """Prepare a table from df in rich. @@ -303,11 +304,18 @@ def print_rich_table( Whether we are exporting the table to a file. If so, we don't want to print it. limit: Optional[int] Limit the number of rows to show. + print_to_console: bool + Whether to print the table to the console. If False and interactive mode is + enabled, the table will be displayed in a new window. Otherwise, it will print to the + console. """ if export: return current_user = get_current_user() + enable_interactive = ( + current_user.preferences.USE_INTERACTIVE_DF and plots_backend().isatty + ) def _get_headers(_headers: Union[List[str], pd.Index]) -> List[str]: """Check if headers are valid and return them.""" @@ -320,7 +328,7 @@ def print_rich_table( ) return output - if current_user.preferences.USE_INTERACTIVE_DF and plots_backend().isatty: + if enable_interactive and not print_to_console: df_outgoing = df.copy() # If headers are provided, use them if headers is not None: diff --git a/openbb_terminal/stocks/technical_analysis/ta_controller.py b/openbb_terminal/stocks/technical_analysis/ta_controller.py index 094ec3cc86e..0c267d12db5 100644 --- a/openbb_terminal/stocks/technical_analysis/ta_controller.py +++ b/openbb_terminal/stocks/technical_analysis/ta_controller.py @@ -1688,7 +1688,7 @@ class TechnicalAnalysisController(StockBaseController): dest="indicators", type=check_indicators, help="Indicators to plot", - required="--indicators" not in other_args, + required="-h" not in other_args, ) parser.add_argument( "-p", diff --git a/tests/openbb_terminal/economy/test_economy_controller.py b/tests/openbb_terminal/economy/test_economy_controller.py index 1089fc01ee3..930d8734bbd 100644 --- a/tests/openbb_terminal/economy/test_economy_controller.py +++ b/tests/openbb_terminal/economy/test_economy_controller.py @@ -835,7 +835,7 @@ def test_call_fred_query(mocker): "other_args, mocked_func, called_args, called_kwargs", [ ( - ["--parameter=dgs2,dgs5"], + ["--parameter", "dgs2,dgs5"], "fred_view.display_fred_series", [], dict( @@ -850,7 +850,7 @@ def test_call_fred_query(mocker): ), ), ( - ["--parameter=DgS2,dgs5", "--export=csv", "--raw"], + ["--parameter", "DgS2,dgs5", "--export=csv", "--raw"], "fred_view.display_fred_series", [], dict( @@ -865,7 +865,7 @@ def test_call_fred_query(mocker): ), ), ( - ["--parameter=DgS2,dgs5", "--export=csv", "--start=2022-10-10"], + ["--parameter", "DgS2,dgs5", "--export=csv", "--start=2022-10-10"], "fred_view.display_fred_series", [], dict(