mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
* section description
* remove comment
* show msg only if it's an OBBject
* ommit coverage from menus
* styling: no new lines after settings
* Bugfix/cli max rows (#6374)
* fix: cli max rows
* fix: settings menu
---------
Co-authored-by: Henrique Joaquim <henriquecjoaquim@gmail.com>
* add a new line only to separate menus and commands
* if there's no menu description on reference.json, use the commands of that menu to create a pseudo description
* use the PATH instead in the top of the menu help
* default name len to 23
* keep command on the obbject so it can be shown on the results
* left spacing regardless description
* display cached results on every platform menu's help
* display info instead of sections and display cached results
* prepend OBB to use on the --data
* config to set number of cached results to display
* correct hub link
* Save routines locally if not logged in.
* Change the exit message
* Point to new docs on first launch.
* proper checking of max_obbjects_exceeded
* fix global flag on local routines
* Remove language from settings as it is not supported.
* Remove rcontext flag
* export to account multiple formats
* Revert "Remove rcontext flag"
This reverts commit 8a1f64b71c.
* Remove
* leftover
* properly match provider being used with provider arguments so that kwargs are correctly filtered
---------
Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
83 lines
1.8 KiB
Python
83 lines
1.8 KiB
Python
"""Configuration for the CLI."""
|
|
|
|
import copy
|
|
from pathlib import Path
|
|
from typing import TYPE_CHECKING, List, Optional, TypeVar
|
|
|
|
import i18n
|
|
|
|
from openbb_cli.config.constants import ENV_FILE_SETTINGS, I18N_FILE, SETTINGS_DIRECTORY
|
|
|
|
if TYPE_CHECKING:
|
|
from openbb_charting.core.openbb_figure import OpenBBFigure
|
|
|
|
# ruff: noqa:PLW0603
|
|
|
|
OpenBBFigureT = TypeVar("OpenBBFigureT", bound="OpenBBFigure")
|
|
HOLD: bool = False
|
|
COMMAND_ON_CHART: bool = True
|
|
current_figure: Optional[OpenBBFigureT] = None # type: ignore
|
|
new_axis: bool = True
|
|
legends: List = []
|
|
last_legend = ""
|
|
|
|
|
|
# pylint: disable=global-statement
|
|
def set_last_legend(leg: str):
|
|
"""Set the last legend."""
|
|
global last_legend
|
|
last_legend = copy.deepcopy(leg)
|
|
|
|
|
|
def reset_legend() -> None:
|
|
"""Reset the legend."""
|
|
global legends
|
|
legends = []
|
|
|
|
|
|
def get_legends() -> list:
|
|
"""Get the legends."""
|
|
return legends
|
|
|
|
|
|
def set_same_axis() -> None:
|
|
"""Set the same axis."""
|
|
global new_axis
|
|
new_axis = False
|
|
|
|
|
|
def set_new_axis() -> None:
|
|
"""Set the new axis."""
|
|
global new_axis
|
|
new_axis = True
|
|
|
|
|
|
def make_new_axis() -> bool:
|
|
"""Make a new axis."""
|
|
return new_axis
|
|
|
|
|
|
def get_current_figure() -> Optional["OpenBBFigure"]:
|
|
"""Get the current figure."""
|
|
return current_figure
|
|
|
|
|
|
def set_current_figure(fig: Optional[OpenBBFigureT] = None):
|
|
"""Set the current figure."""
|
|
# pylint: disable=global-statement
|
|
global current_figure
|
|
current_figure = fig
|
|
|
|
|
|
def setup_i18n(i18n_path: Path = I18N_FILE, lang: str = "en"):
|
|
"""Select the CLI translation language."""
|
|
i18n.load_path.append(i18n_path)
|
|
i18n.set("locale", lang)
|
|
i18n.set("filename_format", "{locale}.{format}")
|
|
|
|
|
|
def bootstrap():
|
|
"""Setup pre-launch configurations for the CLI."""
|
|
SETTINGS_DIRECTORY.mkdir(parents=True, exist_ok=True)
|
|
Path(ENV_FILE_SETTINGS).touch(exist_ok=True)
|