[Feature] Misc improvements on the Platform CLI (#6370)

* 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>
This commit is contained in:
Henrique Joaquim
2024-05-10 14:39:28 +01:00
committed by GitHub
parent 5bd4ae0856
commit 13a62486de
14 changed files with 165 additions and 114 deletions

View File

@@ -52,7 +52,6 @@ class BaseController(metaclass=ABCMeta):
CHOICES_COMMON = [
"cls",
"home",
"about",
"h",
"?",
"help",
@@ -496,14 +495,7 @@ class BaseController(metaclass=ABCMeta):
help="Whether the routine should be public or not",
default=False,
)
parser.add_argument(
"-l",
"--local",
dest="local",
action="store_true",
help="Only save the routine locally - this is necessary if you are running in guest mode.",
default=False,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-n")
@@ -549,17 +541,16 @@ class BaseController(metaclass=ABCMeta):
)
return
if session.is_local() and not ns_parser.local:
if session.is_local():
session.console.print(
"[red]Recording session to the OpenBB Hub is not supported in guest mode.[/red]"
)
session.console.print(
"\n[yellow]Sign to OpenBB Hub to register: http://openbb.co[/yellow]"
"\n[yellow]Visit the OpenBB Hub to register: http://my.openbb.co[/yellow]"
)
session.console.print(
"\n[yellow]Otherwise set the flag '-l' to save the file locally.[/yellow]"
"\n[yellow]Your routine will be saved locally.[/yellow]\n"
)
return
# Check if title has a valid format
title = " ".join(ns_parser.name) if ns_parser.name else ""
@@ -577,8 +568,8 @@ class BaseController(metaclass=ABCMeta):
global SESSION_RECORDED_TAGS # noqa: PLW0603
global SESSION_RECORDED_PUBLIC # noqa: PLW0603
RECORD_SESSION_LOCAL_ONLY = session.is_local()
RECORD_SESSION = True
RECORD_SESSION_LOCAL_ONLY = ns_parser.local
SESSION_RECORDED_NAME = title
SESSION_RECORDED_DESCRIPTION = (
" ".join(ns_parser.description)
@@ -871,6 +862,7 @@ class BaseController(metaclass=ABCMeta):
type=check_file_type_saved(choices_export),
dest="export",
help=help_export,
nargs="+",
)
# If excel is an option, add the sheet name
@@ -1001,7 +993,6 @@ class BaseController(metaclass=ABCMeta):
'<style bg="ansiblack" fg="ansiwhite">[e]</style> exit the program '
'<style bg="ansiblack" fg="ansiwhite">[cmd -h]</style> '
"see usage and available options "
f'<style bg="ansiblack" fg="ansiwhite">[about (cmd/menu)]</style> '
f"{self.path[-1].capitalize()} (cmd/menu) Documentation"
),
style=Style.from_dict(