summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteh_coderer <me@tehcoderer.com>2023-03-06 09:47:50 -0600
committerGitHub <noreply@github.com>2023-03-06 09:47:50 -0600
commit360665cc7624c4db1997f89eaaec309450e06a98 (patch)
treee6fa58b9c957e874e0392236885002c325ed8aad
parentd4521f5f4dba489ad90edeb9577482127a688c87 (diff)
parent9c582ad53f6b080320bd3ca058ebd9f59fbb7c0d (diff)
Merge branch 'develop' into feature/tables
-rw-r--r--openbb_terminal/helper_funcs.py5
-rw-r--r--openbb_terminal/mutual_funds/mutual_fund_controller.py20
2 files changed, 14 insertions, 11 deletions
diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py
index 70125b97428..fadf3af0234 100644
--- a/openbb_terminal/helper_funcs.py
+++ b/openbb_terminal/helper_funcs.py
@@ -664,6 +664,11 @@ def valid_hour(hr: str) -> int:
return new_hr
+def lower_str(string: str) -> str:
+ """Convert string to lowercase."""
+ return string.lower()
+
+
def us_market_holidays(years) -> list:
"""Get US market holidays."""
if isinstance(years, int):
diff --git a/openbb_terminal/mutual_funds/mutual_fund_controller.py b/openbb_terminal/mutual_funds/mutual_fund_controller.py
index 8d4fca6bd98..e6ca90744a5 100644
--- a/openbb_terminal/mutual_funds/mutual_fund_controller.py
+++ b/openbb_terminal/mutual_funds/mutual_fund_controller.py
@@ -15,6 +15,7 @@ from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import (
EXPORT_ONLY_FIGURES_ALLOWED,
check_positive,
+ lower_str,
valid_date,
)
from openbb_terminal.menu import session
@@ -79,7 +80,7 @@ class FundController(BaseController):
mt = MenuText("funds/")
mt.add_cmd("country")
mt.add_raw("\n")
- mt.add_param("_country", self.country.title())
+ mt.add_param("_country", self.country)
mt.add_raw("\n")
mt.add_cmd("search")
mt.add_cmd("load")
@@ -181,29 +182,26 @@ class FundController(BaseController):
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="country",
- description="Set a country for funds",
+ description="Set a country for funds.",
)
parser.add_argument(
"-n",
"--name",
- type=str,
+ type=lower_str,
choices=self.fund_countries,
dest="name",
help="country to select",
- default="",
+ default="united_states",
+ metavar="NAME",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-n")
ns_parser = self.parse_known_args_and_warn(parser, other_args)
if ns_parser:
- country_candidate = ns_parser.name
- if country_candidate.lower() in self.fund_countries:
+ country_candidate = ns_parser.name.lower()
+ if country_candidate in self.fund_countries:
self.country = country_candidate
- console.print(f"{country_candidate.title()} selected.")
- else:
- console.print(
- f'" {country_candidate.title()} " not a valid country to select.'
- )
+ console.print(f"'{country_candidate}' selected.")
return self.queue