summaryrefslogtreecommitdiffstats
path: root/openbb_terminal/custom_prompt_toolkit.py
diff options
context:
space:
mode:
Diffstat (limited to 'openbb_terminal/custom_prompt_toolkit.py')
-rw-r--r--openbb_terminal/custom_prompt_toolkit.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/openbb_terminal/custom_prompt_toolkit.py b/openbb_terminal/custom_prompt_toolkit.py
index b02cab31cb0..1406aba2641 100644
--- a/openbb_terminal/custom_prompt_toolkit.py
+++ b/openbb_terminal/custom_prompt_toolkit.py
@@ -186,7 +186,7 @@ class NestedCompleter(Completer):
return cls(options)
- def get_completions(
+ def get_completions( # noqa: PLR0912
self, document: Document, complete_event: CompleteEvent
) -> Iterable[Completion]:
# Split document.
@@ -195,9 +195,7 @@ class NestedCompleter(Completer):
if " " in text:
cmd = text.split(" ")[0]
if "-" in text:
- if text.rfind("--") == -1:
- unprocessed_text = "-" + text.split("-")[-1]
- elif text.rfind("-") - 1 > text.rfind("--"):
+ if text.rfind("--") == -1 or text.rfind("-") - 1 > text.rfind("--"):
unprocessed_text = "-" + text.split("-")[-1]
else:
unprocessed_text = "--" + text.split("--")[-1]
@@ -268,11 +266,10 @@ class NestedCompleter(Completer):
if "-" not in text:
completer = self.options.get(first_term)
+ elif cmd in self.options and self.options.get(cmd):
+ completer = self.options.get(cmd).options.get(first_term) # type: ignore
else:
- if cmd in self.options and self.options.get(cmd):
- completer = self.options.get(cmd).options.get(first_term) # type: ignore
- else:
- completer = self.options.get(first_term)
+ completer = self.options.get(first_term)
# If we have a sub completer, use this for the completions.
if completer is not None: