Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync merge with main #5838

Merged
merged 8 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
MD_FILES = ["CONTRIBUTING.md", "README.md", "openbb_terminal/SDK_README.md"]
MD_FILES.extend(glob.glob("website/content/sdk/faqs/*.md", recursive=True))
MD_FILES.extend(glob.glob("website/content/terminal/usage/*.md", recursive=True))
MD_FILES.extend(glob.glob("website/content/terminal/menus/*.md", recursive=True))
MD_FILES.extend(
glob.glob("website/content/terminal/data-available/*.md", recursive=True)
)
MD_FILES.extend(glob.glob("website/content/sdk/usage/*.md", recursive=True))
MD_FILES.extend(glob.glob("website/content/sdk/data-available/*.md", recursive=True))

Expand Down
80 changes: 29 additions & 51 deletions openbb_terminal/terminal_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,86 +131,70 @@ def update_terminal():
return 0


def open_openbb_documentation( # noqa: PLR0912
def open_openbb_documentation(
path,
url="https://docs.openbb.co/terminal",
url="https://my.openbb.co/app/terminal",
command=None,
arg_type="",
):
"""Opens the documentation page based on your current location within the terminal. Make exceptions for menus
that are considered 'common' by adjusting the path accordingly."""
if path == "/" and command is None:
path = "/usage/overview/structure-and-navigation"
path = "/usage?path=/usage/structure-and-navigation"
command = ""
elif "keys" in path:
path = "/usage/data/api-keys"
path = "/usage?path=/usage/data/api-keys"
command = ""
elif "settings" in path:
path = "/usage/overview/customizing-the-terminal"
path = "/usage?path=/usage/overview/customizing-the-terminal"
command = ""
elif "featflags" in path:
path = "/usage/overview/customizing-the-terminal#feature-flags-menu"
path = "/usage?path=/usage/overview/customizing-the-terminal#feature-flags-menu"
command = ""
elif "sources" in path:
path = "/usage/usage/data/data-sources"
path = "/usage?path=/usage/usage/data/data-sources"
command = ""
elif "account" in path:
path = "/usage/hub"
path = "/usage?path=/usage/hub"
command = ""
elif arg_type == "command": # user passed a command name
if command in ["settings", "featflags"]:
path = "/usage/overview/customizing-the-terminal"
path = "/usage?path=/usage/overview/customizing-the-terminal"
command = ""
else:
path = f"/reference/{path}"
elif "askobb" in path:
path = "/usage/askobb-feature"
command = ""
path = f"/commands?path={path}"
elif arg_type == "menu": # user passed a menu name
if command in ["ta", "qa"]:
if command in ["ta", "ba", "qa"]:
menu = path.split("/")[-2]
path = f"/menus/common/{menu}"
elif command == "stocks":
path = "/menus/stocks/introduction"
command = ""
path = f"/usage?path=/data-available/common/{menu}"
elif command == "forecast":
command = ""
path = "/menus/forecast"
elif command == "crypto":
path = "/menus/crypto/introduction"
command = ""

path = "/usage?path=/data-available/forecast"
else:
path = f"/menus/{path}"
path = f"/usage?path=/data-available/{path}"
else: # user didn't pass argument and is in a menu
menu = path.split("/")[-2]
if menu == "crypto" and not command:
path = "/crypto/introduction"
if menu == "stocks":
path = "/stocks/introduction"
path = f"/menus/common/{menu}" if menu in ["ta", "qa"] else f"/menus/{path}"
path = (
f"/usage?path=/data-available/common/{menu}"
if menu in ["ta", "ba", "qa"]
else f"/usage?path=/data-available/{path}"
)

if command:
if command == "keys":
path = "/usage/data/api-keys"
path = "/usage?path=/usage/data/api-keys"
command = ""
elif "settings" in path or "featflags" in path:
path = "/usage/overview/customizing-the-terminal"
path = "/usage?path=/usage/overview/customizing-the-terminal"
command = ""
elif "sources" in path:
path = "/usage/data/data-sources"
path = "/usage?path=/usage/data/data-sources"
command = ""
elif command in ["record", "stop", "exe"]:
path = "/usage/routines/introduction-to-routines"
path = "/usage?path=/usage/routines/introduction-to-routines"
command = ""
elif command == "sources":
path = "/usage/data/data-sources"
command = ""
elif command == "askobb":
path = "/usage/askobb-feature"
command = ""
elif command == "news":
path = "/usage/overview/commands-and-arguments#help-arguments"
path = "/usage?path=/usage/data/data-sources"
command = ""
elif command in [
"intro",
Expand All @@ -219,21 +203,15 @@ def open_openbb_documentation( # noqa: PLR0912
"survey",
"update",
"wiki",
"news",
"account",
]:
path = "/usage"
command = ""
elif command in ["ta", "qa"]:
path = f"/menus/common/{command}"
command = ""
elif command == "stocks":
path = "/menus/stocks/introduction"
command = ""
elif command == "account":
path = "/usage/hub"
command = ""
elif command == "news":
path = "/usage/overview/commands-and-arguments#help-arguments"
elif command in ["ta", "ba", "qa"]:
path = f"/usage?path=/data-available/common/{command}"
command = ""

path += command

full_url = f"{url}{path.replace('//', '/')}"
Expand Down
Loading
Loading