From 2e2e5e2fb6f43cbfc77b0c4686d255484dbe6dfa Mon Sep 17 00:00:00 2001 From: jose-donato <43375532+jose-donato@users.noreply.github.com> Date: Sat, 26 Nov 2022 00:42:07 +0000 Subject: [PATCH] fix about command (#3532) * fix(docs): added margin between sections * fix: about command * fix: about command to match new docs * sdk aout * fix: fix homepage * fix: features -> reference on generate; about on homepage * fix: juan magic * update on merge workflows Co-authored-by: James Maslek Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Diogo Sousa Co-authored-by: teh_coderer --- .github/workflows/mac.yml | 1 + .github/workflows/windows.yml | 1 + .../alternative/covid/covid_model.py | 15 ---- openbb_terminal/core/library/breadcrumb.py | 2 +- openbb_terminal/core/library/operation.py | 2 +- openbb_terminal/parent_classes.py | 10 ++- openbb_terminal/terminal_helper.py | 68 ++++++++++++++----- website/generate_terminal_markdown.py | 7 +- website/src/theme/NotFound.js | 38 ++++++----- 9 files changed, 91 insertions(+), 53 deletions(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 3b1cd0f699a..440df2f0971 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -75,6 +75,7 @@ jobs: run: | conda info pip install --requirement requirements-full.txt + pip install docstring_parser - name: List installed packages (Bash) shell: bash -l {0} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 451c7cda3f3..5b470bdd0fc 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -87,6 +87,7 @@ jobs: run: | conda info pip install --requirement requirements-full.txt + pip install docstring_parser - name: List installed packages (Bash) shell: bash -l {0} diff --git a/openbb_terminal/alternative/covid/covid_model.py b/openbb_terminal/alternative/covid/covid_model.py index 4f039214e21..4589437043d 100644 --- a/openbb_terminal/alternative/covid/covid_model.py +++ b/openbb_terminal/alternative/covid/covid_model.py @@ -35,21 +35,6 @@ def get_global_cases(country: str) -> pd.DataFrame: ------- pd.DataFrame Dataframe of historical cases - - Examples - -------- - - >>> df = get_global_cases("United States") - Dataframe of historical cases for United States - - - >>> df = get_global_cases("Portugal") - Dataframe of historical cases for Portugal - - - >>> df = get_global_cases("Spain") - Dataframe of historical cases for Spain - """ cases = pd.read_csv(global_cases_time_series) cases = cases.rename(columns={"Country/Region": "Country"}) diff --git a/openbb_terminal/core/library/breadcrumb.py b/openbb_terminal/core/library/breadcrumb.py index 49505721ed5..af525e88bab 100644 --- a/openbb_terminal/core/library/breadcrumb.py +++ b/openbb_terminal/core/library/breadcrumb.py @@ -140,7 +140,7 @@ class Breadcrumb: import webbrowser trail = self._trail - url = "https://openbb-finance.github.io/OpenBBTerminal/SDK/" + url = "https://docs.openbb.co/sdk/reference/" url += "/".join(trail.split(".")) webbrowser.open(url) diff --git a/openbb_terminal/core/library/operation.py b/openbb_terminal/core/library/operation.py index 2d9fc1e952f..89e80903810 100644 --- a/openbb_terminal/core/library/operation.py +++ b/openbb_terminal/core/library/operation.py @@ -109,7 +109,7 @@ class Operation: import webbrowser trail = self._trail - url = "https://openbb-finance.github.io/OpenBBTerminal/SDK/" + url = "https://docs.openbb.co/sdk/reference/" url += "/".join(trail.split(".")) webbrowser.open(url) diff --git a/openbb_terminal/parent_classes.py b/openbb_terminal/parent_classes.py index 997dc175919..9355f29535f 100644 --- a/openbb_terminal/parent_classes.py +++ b/openbb_terminal/parent_classes.py @@ -419,7 +419,15 @@ class BaseController(metaclass=ABCMeta): ns_parser = self.parse_known_args_and_warn(parser, other_args) if ns_parser: - open_openbb_documentation(self.PATH, command=ns_parser.command) + arg_type = "" + if ns_parser.command in self.CHOICES_COMMANDS: + arg_type = "command" + elif ns_parser.command in self.CHOICES_MENUS: + arg_type = "menu" + + open_openbb_documentation( + self.PATH, command=ns_parser.command, arg_type=arg_type + ) @log_start_end(log=logger) def call_quit(self, _) -> None: diff --git a/openbb_terminal/terminal_helper.py b/openbb_terminal/terminal_helper.py index a7dee8dbbf4..67a729c3011 100644 --- a/openbb_terminal/terminal_helper.py +++ b/openbb_terminal/terminal_helper.py @@ -118,42 +118,74 @@ def update_terminal(): def open_openbb_documentation( - path, url="https://openbb-finance.github.io/OpenBBTerminal/", command=None + path, url="https://docs.openbb.co/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 "ta" in path: - path = "terminal/common/ta/" - elif "ba" in path: - path = "terminal/common/ba/" - elif "qa" in path: - path = "terminal/common/qa/" - elif "keys" in path: - path = "#accessing-other-sources-of-data-via-api-keys" + if path == "/" and command is None: + path = "/" command = "" - elif "settings" in path or "featflags" in path or "sources" in path: - path = "#customizing-the-terminal" + elif "keys" in path: + path = "/guides/basics/keys" + command = "" + elif "settings" in path: + path = "/guides/basics/customizing_the_terminal" + command = "" + elif "featflags" in path: + path = "/guides/basics/customizing_the_terminal" + command = "" + elif "sources" in path: + path = "/guides/advanced/changing_sources" command = "" else: - path = f"terminal/{path}" + if arg_type == "command": # user passed a command name + path = f"/reference/{path}" + elif arg_type == "menu": # user passed a menu name + if command in ["ta", "ba", "qa"]: + menu = path.split("/")[-2] + path = f"/guides/intros/common/{menu}" + elif command == "forecast": + command = "" + path = "/guides/intros/forecast" + else: + path = f"/guides/intros/{path}" + else: # user didn't pass argument and is in a menu + menu = path.split("/")[-2] + if menu in ["ta", "ba", "qa"]: + path = f"/guides/intros/common/{menu}" + else: + path = f"/guides/intros/{path}" if command: - if command in ["ta", "ba", "qa"]: - path = "terminal/common/" - elif "keys" == command: - path = "#accessing-other-sources-of-data-via-api-keys" + if "keys" == command: + path = "/guides/basics/keys" + command = "" + elif "settings" in path: + path = "/guides/basics/customizing_the_terminal" + command = "" + elif "featflags" in path: + path = "/guides/basics/customizing_the_terminal" + command = "" + elif "sources" in path: + path = "/guides/advanced/changing_sources" command = "" elif "exe" == command: - path = "/terminal/scripts/" + path = "/quickstart/scripts" command = "" elif command in ["settings", "featflags", "sources"]: - path = "#customizing-the-terminal" + path = "" + command = "" + elif command in ["ta", "ba", "qa"]: + path = f"/guides/intros/common/{command}" command = "" path += command full_url = f"{url}{path}".replace("//", "/") + if full_url[-1] == "/": + full_url = full_url[:-1] + webbrowser.open(full_url) diff --git a/website/generate_terminal_markdown.py b/website/generate_terminal_markdown.py index e80a7fe4d17..181805df5d5 100644 --- a/website/generate_terminal_markdown.py +++ b/website/generate_terminal_markdown.py @@ -183,7 +183,7 @@ def add_todict(d: dict, location_path: list, cmd_name: str, full_path: str) -> d else: d[location_path[0]][ cmd_name - ] = f"/terminal/features/{'/'.join(full_path)}/{cmd_name}" + ] = f"/terminal/reference/{'/'.join(full_path)}/{cmd_name}" return d @@ -236,6 +236,11 @@ def main() -> bool: console.print(f"[red]Failed to generate markdown for {ctrlstr}: {e}[/red]") return False + terminal_ref = { + k: dict(sorted(v.items(), key=lambda item: item[0])) + for k, v in sorted(terminal_ref.items(), key=lambda item: item[0]) + } + with open(content_path / "_category_.json", "w", **kwargs) as f: f.write(json.dumps({"label": "Terminal Reference", "position": 4}, indent=2)) diff --git a/website/src/theme/NotFound.js b/website/src/theme/NotFound.js index 3ddc4fd14c0..f6934d942ca 100644 --- a/website/src/theme/NotFound.js +++ b/website/src/theme/NotFound.js @@ -1,42 +1,46 @@ -import React from 'react'; -import Translate, {translate} from '@docusaurus/Translate'; -import {PageMetadata} from '@docusaurus/theme-common'; -import Layout from '@theme/Layout'; +import React from "react"; +import Translate, { translate } from "@docusaurus/Translate"; +import { PageMetadata } from "@docusaurus/theme-common"; +import Layout from "@theme/Layout"; export default function NotFound() { return ( <> -
+

+ description="The title of the 404 page" + > Page Not Found

-

- We could not find what you were looking for. +

+ We could not find what you were looking for.

- We recently moved our documentation to a new location and some links may be broken. Popular links are listed below: + We recently moved our documentation to a new location and some + links may be broken. Popular links are listed below:

-