From b3d9ef479cda17442e2ea535274140a1b4b89665 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Mon, 5 Jul 2021 09:17:24 +0100 Subject: [PATCH] Improve menu UX (#532) * Improve bt menu * minor typo * improve ba menu * improve brokers menu * improve CA menu * improve crypto menu * improve disc menu * improve dd menu * improve econ menu * improve etf menu * improve EDA menu * improve fx menu * improve FA menu * improve gov menu * improve op menu * improve mill menu * improve pa menu * improve pred menu * improve res menu * improve ra menu * improve rc menu * improve scr menu * improve po menu * improve ta menu * improve main terminal menu --- .../backtesting/bt_controller.py | 22 ++++++- .../behavioural_analysis/ba_controller.py | 21 ++++++- gamestonk_terminal/brokers/bro_controller.py | 23 ++++++- .../brokers/degiro/degiro_controller.py | 18 ++++++ .../comparison_analysis/ca_controller.py | 22 ++++++- .../binance/binance_controller.py | 34 ++++++++++- .../coingecko/pycoingecko_controller.py | 22 ++++++- .../coinmarketcap/coinmarketcap_controller.py | 22 ++++++- .../cryptocurrency/crypto_controller.py | 22 ++++++- .../discovery/disc_controller.py | 20 ++++++- .../due_diligence/dd_controller.py | 22 ++++++- gamestonk_terminal/economy/econ_controller.py | 22 ++++++- gamestonk_terminal/etf/etf_controller.py | 33 +++++++++- .../eda_controller.py | 22 ++++++- gamestonk_terminal/forex/fx_controller.py | 60 ++++++++++++------- .../alpha_vantage/av_controller.py | 21 +++++++ .../fundamental_analysis/fa_controller.py | 25 ++++++-- .../financial_modeling_prep/fmp_controller.py | 22 ++++++- .../government/gov_controller.py | 22 ++++++- gamestonk_terminal/options/op_controller.py | 22 ++++++- .../papermill/papermill_controller.py | 22 ++++++- .../portfolio_analysis/pa_controller.py | 21 ++++++- .../portfolio_optimization/po_controller.py | 22 ++++++- .../prediction_techniques/pred_controller.py | 22 ++++++- gamestonk_terminal/research/res_controller.py | 22 ++++++- .../residuals_analysis/ra_controller.py | 22 ++++++- .../resource_collection/rc_controller.py | 22 ++++++- .../screener/screener_controller.py | 21 ++++++- .../technical_analysis/ta_controller.py | 22 ++++++- terminal.py | 22 ++++++- 30 files changed, 660 insertions(+), 55 deletions(-) diff --git a/gamestonk_terminal/backtesting/bt_controller.py b/gamestonk_terminal/backtesting/bt_controller.py index d67f4d75142..988e6474c7b 100644 --- a/gamestonk_terminal/backtesting/bt_controller.py +++ b/gamestonk_terminal/backtesting/bt_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List, Union from datetime import datetime import matplotlib as mpl @@ -25,7 +26,7 @@ mpl.use(default_backend) class BacktestingController: """Backtesting Class""" - CHOICES = ["help", "q", "quit", "ema", "ema_cross", "rsi"] + CHOICES = ["?", "cls", "help", "q", "quit", "ema", "ema_cross", "rsi"] def __init__( self, @@ -46,7 +47,8 @@ class BacktestingController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/backtesting" ) print("\nBacktesting:") - print(" help show this backtesting menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -66,8 +68,23 @@ class BacktestingController: None - continue in the menu """ + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.bt_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) @@ -118,6 +135,7 @@ def menu(ticker: str, start: Union[str, datetime]): try: plt.close("all") + process_input = bt_controller.switch(an_input) if process_input is not None: return process_input diff --git a/gamestonk_terminal/behavioural_analysis/ba_controller.py b/gamestonk_terminal/behavioural_analysis/ba_controller.py index 84dd6a153ea..5ab14d272da 100644 --- a/gamestonk_terminal/behavioural_analysis/ba_controller.py +++ b/gamestonk_terminal/behavioural_analysis/ba_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from datetime import datetime from prompt_toolkit.completion import NestedCompleter @@ -23,6 +24,8 @@ class BehaviouralAnalysisController: # Command choices CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -62,7 +65,8 @@ class BehaviouralAnalysisController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/behavioural_analysis" ) print("\nBehavioural Analysis:") - print(" help show this behavioural analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -109,8 +113,23 @@ class BehaviouralAnalysisController: True - quit the program None - continue in the menu """ + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.ba_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/brokers/bro_controller.py b/gamestonk_terminal/brokers/bro_controller.py index 5d944a07025..2b3100931fc 100644 --- a/gamestonk_terminal/brokers/bro_controller.py +++ b/gamestonk_terminal/brokers/bro_controller.py @@ -3,6 +3,7 @@ __docformat__ = "numpy" # pylint: disable=R1710 import argparse +import os from typing import List import pandas as pd from prompt_toolkit.completion import NestedCompleter @@ -26,6 +27,8 @@ class BrokersController: """Brokers Controller""" CHOICES = [ + "?", + "cls", "alphist", "alphold", "allyhold", @@ -56,13 +59,16 @@ class BrokersController: print( "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/brokers" ) + print() + print(" ?/help show this menu again") print( "\nBrokers Supported:\n" " ally - Ally Invest\n" " alp - Alpaca\n" " rh - Robinhood\n" "\nPortfolio:\n" - " help show this menu again\n" + " cls clear screen\n" + " ?/help show this menu again\n" " q quit this menu, and shows back to main menu, logs out of brokers\n" " quit quit to abandon program, logs out of brokers\n" ) @@ -97,8 +103,23 @@ class BrokersController: None - continue in the menu """ + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.bro_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/brokers/degiro/degiro_controller.py b/gamestonk_terminal/brokers/degiro/degiro_controller.py index 3e7e59d16c1..e853b1bc828 100644 --- a/gamestonk_terminal/brokers/degiro/degiro_controller.py +++ b/gamestonk_terminal/brokers/degiro/degiro_controller.py @@ -1,5 +1,6 @@ # IMPORTATION STANDARD import argparse +import os # IMPORTATION THIRDPARTY from prompt_toolkit.completion import NestedCompleter @@ -18,6 +19,8 @@ from gamestonk_terminal.brokers.degiro.degiro_view import DegiroView class DegiroController: CHOICES = [ + "?", + "cls", "cancel", "companynews", "create", @@ -343,8 +346,23 @@ class DegiroController: try: degiro_parser = self.__degiro_parser + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = degiro_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + DegiroView.help_display() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, known_args.cmd, diff --git a/gamestonk_terminal/comparison_analysis/ca_controller.py b/gamestonk_terminal/comparison_analysis/ca_controller.py index 6b23cee6cbf..26f44dc62c2 100644 --- a/gamestonk_terminal/comparison_analysis/ca_controller.py +++ b/gamestonk_terminal/comparison_analysis/ca_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os import random from typing import List from datetime import datetime @@ -27,6 +28,8 @@ class ComparisonAnalysisController: # Command choices CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -101,7 +104,8 @@ class ComparisonAnalysisController: print(f"[{self.user}] Similar Companies: {', '.join(self.similar)}") print("\nComparison Analysis Mode:") - print(" help show this comparison analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -281,8 +285,24 @@ class ComparisonAnalysisController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.ca_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/cryptocurrency/binance/binance_controller.py b/gamestonk_terminal/cryptocurrency/binance/binance_controller.py index c7892674768..55943482af4 100644 --- a/gamestonk_terminal/cryptocurrency/binance/binance_controller.py +++ b/gamestonk_terminal/cryptocurrency/binance/binance_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" # pylint: disable=R0904, C0302, W0622 import argparse +import os import pandas as pd from prompt_toolkit.completion import NestedCompleter from gamestonk_terminal import feature_flags as gtff @@ -13,7 +14,19 @@ from gamestonk_terminal.technical_analysis import ta_controller class BinanceController: - CHOICES = ["help", "q", "quit", "book", "candle", "balance", "load", "ta", "clear"] + CHOICES = [ + "?", + "cls", + "help", + "q", + "quit", + "book", + "candle", + "balance", + "load", + "ta", + "clear", + ] def __init__(self): """CONSTRUCTOR""" @@ -28,7 +41,8 @@ class BinanceController: def print_help(self): """Print help""" print("\nBinance:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -52,10 +66,26 @@ class BinanceController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self._binance_parser.parse_known_args( an_input.split() ) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/cryptocurrency/coingecko/pycoingecko_controller.py b/gamestonk_terminal/cryptocurrency/coingecko/pycoingecko_controller.py index 314858e68c0..ec349035a7a 100644 --- a/gamestonk_terminal/cryptocurrency/coingecko/pycoingecko_controller.py +++ b/gamestonk_terminal/cryptocurrency/coingecko/pycoingecko_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" # pylint: disable=R0904, C0302, W0622 import argparse +import os import pandas as pd from prompt_toolkit.completion import NestedCompleter from gamestonk_terminal import feature_flags as gtff @@ -14,6 +15,8 @@ from gamestonk_terminal.technical_analysis import ta_controller class GeckoController: CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -74,7 +77,8 @@ class GeckoController: def print_help(self): """Print help""" print("\nCoinGecko:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -145,8 +149,24 @@ class GeckoController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self._gecko_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/cryptocurrency/coinmarketcap/coinmarketcap_controller.py b/gamestonk_terminal/cryptocurrency/coinmarketcap/coinmarketcap_controller.py index b2d25dfd106..4c799719f49 100644 --- a/gamestonk_terminal/cryptocurrency/coinmarketcap/coinmarketcap_controller.py +++ b/gamestonk_terminal/cryptocurrency/coinmarketcap/coinmarketcap_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" # pylint: disable=R0904, C0302, W0622 import argparse +import os import pandas as pd from prompt_toolkit.completion import NestedCompleter from gamestonk_terminal import feature_flags as gtff @@ -15,6 +16,8 @@ from gamestonk_terminal.cryptocurrency.coinmarketcap import ( class CMCController: CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -34,7 +37,8 @@ class CMCController: def print_help(self): """Print help""" print("\nCoinmarketcap:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print(" top view top coins from coinmarketcap") @@ -50,8 +54,24 @@ class CMCController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self._cmc_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/cryptocurrency/crypto_controller.py b/gamestonk_terminal/cryptocurrency/crypto_controller.py index 66d8da787f8..13b8423b0e9 100644 --- a/gamestonk_terminal/cryptocurrency/crypto_controller.py +++ b/gamestonk_terminal/cryptocurrency/crypto_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" # pylint: disable=R0904, C0302, R1710 import argparse +import os import matplotlib.pyplot as plt from prompt_toolkit.completion import NestedCompleter from gamestonk_terminal import feature_flags as gtff @@ -15,6 +16,8 @@ from gamestonk_terminal.cryptocurrency.coingecko import pycoingecko_controller class CryptoController: CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -35,7 +38,8 @@ class CryptoController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/cryptocurrency" ) print("\nCryptocurrency:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -54,8 +58,24 @@ class CryptoController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.crypto_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/discovery/disc_controller.py b/gamestonk_terminal/discovery/disc_controller.py index 9d6a4e1268d..c3f8dfb0044 100644 --- a/gamestonk_terminal/discovery/disc_controller.py +++ b/gamestonk_terminal/discovery/disc_controller.py @@ -32,6 +32,8 @@ class DiscoveryController: # Command choices CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -75,7 +77,8 @@ class DiscoveryController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/discovery" ) print("\nDiscovery Mode:") - print(" help show this discovery menu again") + print(" cls clear screen") + print(" ?/help show this discovery menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -121,6 +124,11 @@ class DiscoveryController: True - quit the program None - continue in the menu """ + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.disc_parser.parse_known_args(an_input.split()) # Due to Finviz implementation of Spectrum, we delete the generated spectrum figure @@ -131,6 +139,16 @@ class DiscoveryController: os.remove(self.spectrum_img_to_delete + ".jpg") self.spectrum_img_to_delete = "" + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/due_diligence/dd_controller.py b/gamestonk_terminal/due_diligence/dd_controller.py index 7f6e7be9754..3c01943fd35 100644 --- a/gamestonk_terminal/due_diligence/dd_controller.py +++ b/gamestonk_terminal/due_diligence/dd_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from pandas.core.frame import DataFrame from prompt_toolkit.completion import NestedCompleter @@ -27,6 +28,8 @@ class DueDiligenceController: # Command choices CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -88,7 +91,8 @@ class DueDiligenceController: print(f"\n{intraday} Stock: {self.ticker}") print("\nDue Diligence:") - print(" help show this fundamental analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -128,8 +132,24 @@ class DueDiligenceController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.dd_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/economy/econ_controller.py b/gamestonk_terminal/economy/econ_controller.py index 401872c335d..a915a8a8934 100644 --- a/gamestonk_terminal/economy/econ_controller.py +++ b/gamestonk_terminal/economy/econ_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from prompt_toolkit.completion import NestedCompleter from gamestonk_terminal import feature_flags as gtff @@ -17,6 +18,8 @@ class EconomyController: # Command choices CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -51,7 +54,8 @@ class EconomyController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/economy" ) print("\nEconomic Data:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print(" ") @@ -84,8 +88,24 @@ class EconomyController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.econ_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/etf/etf_controller.py b/gamestonk_terminal/etf/etf_controller.py index 71cf567b3da..e07f6e8cd31 100644 --- a/gamestonk_terminal/etf/etf_controller.py +++ b/gamestonk_terminal/etf/etf_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List import matplotlib.pyplot as plt from prompt_toolkit.completion import NestedCompleter @@ -18,7 +19,18 @@ from gamestonk_terminal.etf.stockanalysis_model import ( class ETFController: - CHOICES = ["help", "q", "quit", "web", "search", "overview", "compare", "holdings"] + CHOICES = [ + "cls", + "?", + "help", + "q", + "quit", + "web", + "search", + "overview", + "compare", + "holdings", + ] def __init__(self): """CONSTRUCTOR""" @@ -32,7 +44,8 @@ class ETFController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/etf" ) print("\nETF:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("\nStockAnalysis.com") @@ -54,8 +67,24 @@ class ETFController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.etf_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/exploratory_data_analysis/eda_controller.py b/gamestonk_terminal/exploratory_data_analysis/eda_controller.py index 7cd5219b92c..f9937a6b8df 100644 --- a/gamestonk_terminal/exploratory_data_analysis/eda_controller.py +++ b/gamestonk_terminal/exploratory_data_analysis/eda_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from datetime import datetime import pandas as pd @@ -18,6 +19,8 @@ class EdaController: # Command choices CHOICES = [ + "?", + "cls", "help", "q", "quit", @@ -66,7 +69,8 @@ class EdaController: print(f"\n{s_intraday} Stock: {self.ticker}") print("\nExploratory Data Analysis:") - print(" help show this comparison analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -92,8 +96,24 @@ class EdaController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.stats_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/forex/fx_controller.py b/gamestonk_terminal/forex/fx_controller.py index ab701c90d99..d67e8686c56 100644 --- a/gamestonk_terminal/forex/fx_controller.py +++ b/gamestonk_terminal/forex/fx_controller.py @@ -1,4 +1,5 @@ import argparse +import os from typing import List import pandas as pd from prompt_toolkit.completion import NestedCompleter @@ -19,6 +20,8 @@ class ForexController: """Oanda Controller class""" CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -57,37 +60,38 @@ class ForexController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/forex" ) print("\nForex Mode:") - print(" help show this menu again") - print(" q quit this menu and goes back to main menu") - print(" quit quit to abandon program") + print(" cls clear screen") + print(" ?/help show this menu again") + print(" q quit this menu and goes back to main menu") + print(" quit quit to abandon program") print("") - print(" summary shows account summary") - print(" calendar show calendar") - print(" list list order history") - print(" pending get information on pending orders") - print(" cancel cancel a pending order by ID -i order ID") - print(" positions get open positions") - print(" trades list open trades") - print(" closetrade close a trade by id") + print(" summary shows account summary") + print(" calendar show calendar") + print(" list list order history") + print(" pending get information on pending orders") + print(" cancel cancel a pending order by ID -i order ID") + print(" positions get open positions") + print(" trades list open trades") + print(" closetrade close a trade by id") print("") print(f"Loaded instrument: {self.instrument if self.instrument else ''}") print("") print(" load load an instrument to use") if self.instrument: - print(" candles show candles") - print(" price shows price for selected instrument") - print(" order place limit order -u # of units -p price") - print(" orderbook print orderbook") - print(" positionbook print positionbook") - print(" news print news [News API]") + print(" candles show candles") + print(" price shows price for selected instrument") + print(" order place limit order -u # of units -p price") + print(" orderbook print orderbook") + print(" positionbook print positionbook") + print(" news print news [News API]") print( - " reddit search reddit for posts about the loaded instrument" + " reddit search reddit for posts about the loaded instrument" ) print( - " > eda exploratory data analysis, e.g.: decompose, cusum, residuals analysis" + "> eda exploratory data analysis, e.g.: decompose, cusum, residuals analysis" ) print( - " > ba behavioural analysis, from: reddit, stocktwits, twitter, google" + "> ba behavioural analysis, from: reddit, stocktwits, twitter, google" ) print("") @@ -101,8 +105,24 @@ class ForexController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.fx_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "command not recognized!" )(other_args) diff --git a/gamestonk_terminal/fundamental_analysis/alpha_vantage/av_controller.py b/gamestonk_terminal/fundamental_analysis/alpha_vantage/av_controller.py index 42f79d1bc73..4ef17c8421c 100644 --- a/gamestonk_terminal/fundamental_analysis/alpha_vantage/av_controller.py +++ b/gamestonk_terminal/fundamental_analysis/alpha_vantage/av_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from prompt_toolkit.completion import NestedCompleter @@ -16,6 +17,8 @@ class AlphaVantageController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -65,6 +68,8 @@ class AlphaVantageController: print(f"\n{intraday} Stock: {self.ticker}") print("\nAlpha Vantage:") + print(" cls clear screen") + print(" ?/help show this menu again") print(" help show this alpha vantage menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") @@ -87,8 +92,24 @@ class AlphaVantageController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.av_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/fundamental_analysis/fa_controller.py b/gamestonk_terminal/fundamental_analysis/fa_controller.py index f5fe497969a..1749916ed7e 100644 --- a/gamestonk_terminal/fundamental_analysis/fa_controller.py +++ b/gamestonk_terminal/fundamental_analysis/fa_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from prompt_toolkit.completion import NestedCompleter @@ -26,6 +27,8 @@ class FundamentalAnalysisController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -80,10 +83,9 @@ class FundamentalAnalysisController: else: print(f"\n{intraday} Stock: {self.ticker}") - print( - "\nFundamental Analysis:" - ) # https://github.com/JerBouma/FundamentalAnalysis - print(" help show this fundamental analysis menu again") + print("\nFundamental Analysis:") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -120,8 +122,23 @@ class FundamentalAnalysisController: None - continue in the menu """ + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.fa_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/fundamental_analysis/financial_modeling_prep/fmp_controller.py b/gamestonk_terminal/fundamental_analysis/financial_modeling_prep/fmp_controller.py index 1e29f02c2ce..030a9430a61 100644 --- a/gamestonk_terminal/fundamental_analysis/financial_modeling_prep/fmp_controller.py +++ b/gamestonk_terminal/fundamental_analysis/financial_modeling_prep/fmp_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from prompt_toolkit.completion import NestedCompleter @@ -18,6 +19,8 @@ class FinancialModelingPrepController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -71,7 +74,8 @@ class FinancialModelingPrepController: print(f"\n{intraday} Stock: {self.ticker}") print("\nFinancial Modeling Prep API") - print(" help show this financial modeling prep menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -97,8 +101,24 @@ class FinancialModelingPrepController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.fmp_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/government/gov_controller.py b/gamestonk_terminal/government/gov_controller.py index 12cdc369f2c..a7821c077b0 100644 --- a/gamestonk_terminal/government/gov_controller.py +++ b/gamestonk_terminal/government/gov_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from matplotlib import pyplot as plt from prompt_toolkit.completion import NestedCompleter @@ -16,6 +17,8 @@ class GovController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -62,7 +65,8 @@ class GovController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/government" ) print("\nExploratory Data Analysis:") - print(" help show this comparison analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -106,8 +110,24 @@ class GovController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.gov_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/options/op_controller.py b/gamestonk_terminal/options/op_controller.py index 9a83cc96c04..90e5a46473d 100644 --- a/gamestonk_terminal/options/op_controller.py +++ b/gamestonk_terminal/options/op_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List import matplotlib.pyplot as plt import pandas as pd @@ -24,6 +25,8 @@ class OptionsController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -114,7 +117,8 @@ class OptionsController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/options" ) print("\nOptions:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -145,8 +149,24 @@ class OptionsController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.op_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help(self.expiry_date) + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/papermill/papermill_controller.py b/gamestonk_terminal/papermill/papermill_controller.py index fbd8bb4631c..3ec0db22d34 100644 --- a/gamestonk_terminal/papermill/papermill_controller.py +++ b/gamestonk_terminal/papermill/papermill_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from gamestonk_terminal.papermill import due_diligence_view @@ -20,7 +21,7 @@ class PapermillController: ) self.papermill_parser.add_argument( "cmd", - choices=["help", "q", "quit", "dd", "econ"], + choices=["cls", "?", "help", "q", "quit", "dd", "econ"], ) def switch(self, an_input: str): @@ -33,10 +34,26 @@ class PapermillController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.papermill_parser.parse_known_args( an_input.split() ) + # Help menu again + if known_args.cmd == "?": + print_papermill() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) @@ -68,7 +85,8 @@ def print_papermill(): "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/papermill" ) print("\nPapermill Reports:") - print(" help show this papermill menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") diff --git a/gamestonk_terminal/portfolio_analysis/pa_controller.py b/gamestonk_terminal/portfolio_analysis/pa_controller.py index 6a426cab2e4..bc04d01ece0 100644 --- a/gamestonk_terminal/portfolio_analysis/pa_controller.py +++ b/gamestonk_terminal/portfolio_analysis/pa_controller.py @@ -1,6 +1,7 @@ __docformat__ = "numpy" import argparse +import os import pandas as pd from prompt_toolkit.completion import NestedCompleter @@ -15,6 +16,8 @@ class PortfolioController: """Portfolio Controller""" CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -34,7 +37,8 @@ class PortfolioController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/portfolio_analysis" ) print("\nPortfolio Analysis:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -57,8 +61,23 @@ class PortfolioController: None - continue in the menu """ + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.pa_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/portfolio_optimization/po_controller.py b/gamestonk_terminal/portfolio_optimization/po_controller.py index 40a52cdbb40..cc29459ebcc 100644 --- a/gamestonk_terminal/portfolio_optimization/po_controller.py +++ b/gamestonk_terminal/portfolio_optimization/po_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List import matplotlib.pyplot as plt from prompt_toolkit.completion import NestedCompleter @@ -14,6 +15,8 @@ from gamestonk_terminal.portfolio_optimization import optimizer_view class PortfolioOptimization: CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -53,7 +56,8 @@ class PortfolioOptimization: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/portfolio_optimization" ) print("\nPortfolio Optimization:") - print(" help show this menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print(f"\nCurrent Tickers: {('None', ', '.join(tickers))[bool(tickers)]}") @@ -96,8 +100,24 @@ class PortfolioOptimization: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.po_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help(self.tickers) + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/prediction_techniques/pred_controller.py b/gamestonk_terminal/prediction_techniques/pred_controller.py index 72bd2e71838..f91843206f9 100644 --- a/gamestonk_terminal/prediction_techniques/pred_controller.py +++ b/gamestonk_terminal/prediction_techniques/pred_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from datetime import datetime import pandas as pd @@ -25,6 +26,8 @@ class PredictionTechniquesController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -74,7 +77,8 @@ class PredictionTechniquesController: print(f"\n{s_intraday} Stock: {self.ticker}") print("\nPrediction Techniques:") - print(" help show this prediction techniques menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -101,8 +105,24 @@ class PredictionTechniquesController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.pred_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/research/res_controller.py b/gamestonk_terminal/research/res_controller.py index 121a4ab4014..f4bab461e14 100644 --- a/gamestonk_terminal/research/res_controller.py +++ b/gamestonk_terminal/research/res_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os import webbrowser from datetime import datetime from prompt_toolkit.completion import NestedCompleter @@ -15,6 +16,8 @@ class ResearchController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -64,7 +67,8 @@ class ResearchController: print(f"\n{s_intraday} Stock: {self.ticker}") print("\nResearch:") - print(" help show this behavioural analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -97,8 +101,24 @@ class ResearchController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.res_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + if other_args: print(f"The following args were unexpected: {other_args}") diff --git a/gamestonk_terminal/residuals_analysis/ra_controller.py b/gamestonk_terminal/residuals_analysis/ra_controller.py index fe8e3bb4be2..01a762ee575 100644 --- a/gamestonk_terminal/residuals_analysis/ra_controller.py +++ b/gamestonk_terminal/residuals_analysis/ra_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from datetime import datetime import pandas as pd @@ -19,6 +20,8 @@ class ResidualsController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -75,7 +78,8 @@ class ResidualsController: print(f"\nModel fit: {self.model_name}") print("\nResiduals Analysis:") - print(" help show this comparison analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print(" pick pick one of the model fitting.") @@ -163,8 +167,24 @@ class ResidualsController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.ra_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/resource_collection/rc_controller.py b/gamestonk_terminal/resource_collection/rc_controller.py index 05541e1cbc4..45aa699d735 100644 --- a/gamestonk_terminal/resource_collection/rc_controller.py +++ b/gamestonk_terminal/resource_collection/rc_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os import webbrowser from prompt_toolkit.completion import NestedCompleter from gamestonk_terminal import feature_flags as gtff @@ -14,6 +15,8 @@ class ResourceCollectionController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -40,7 +43,8 @@ class ResourceCollectionController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/resource_collection" ) print("\nResources:") - print(" help show this behavioural analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -62,8 +66,24 @@ class ResourceCollectionController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.rc_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + if other_args: print(f"The following args were unexpected: {other_args}") diff --git a/gamestonk_terminal/screener/screener_controller.py b/gamestonk_terminal/screener/screener_controller.py index 9c5b50ec67b..619bffcb8db 100644 --- a/gamestonk_terminal/screener/screener_controller.py +++ b/gamestonk_terminal/screener/screener_controller.py @@ -25,6 +25,8 @@ class ScreenerController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -57,7 +59,8 @@ class ScreenerController: "https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/screener" ) print("\nScreener:") - print(" help show this screener menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -204,8 +207,24 @@ class ScreenerController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.scr_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/gamestonk_terminal/technical_analysis/ta_controller.py b/gamestonk_terminal/technical_analysis/ta_controller.py index fbeb3f63d11..6554a1dd278 100644 --- a/gamestonk_terminal/technical_analysis/ta_controller.py +++ b/gamestonk_terminal/technical_analysis/ta_controller.py @@ -2,6 +2,7 @@ __docformat__ = "numpy" import argparse +import os from typing import List from datetime import datetime import pandas as pd @@ -27,6 +28,8 @@ class TechnicalAnalysisController: # Command choices CHOICES = [ + "cls", + "?", "help", "q", "quit", @@ -82,7 +85,8 @@ class TechnicalAnalysisController: print(f"\n{s_intraday} Stock: {self.ticker}") print("\nTechnical Analysis:") # https://github.com/twopirllc/pandas-ta - print(" help show this technical analysis menu again") + print(" cls clear screen") + print(" ?/help show this menu again") print(" q quit this menu, and shows back to main menu") print(" quit quit to abandon program") print("") @@ -122,8 +126,24 @@ class TechnicalAnalysisController: True - quit the program None - continue in the menu """ + + # Empty command + if not an_input: + print("") + return None + (known_args, other_args) = self.ta_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args) diff --git a/terminal.py b/terminal.py index a6a757ebbed..ca9fd678951 100644 --- a/terminal.py +++ b/terminal.py @@ -3,7 +3,7 @@ __docformat__ = "numpy" import argparse - +import os import sys from datetime import datetime, timedelta from typing import List @@ -75,6 +75,8 @@ class TerminalController: ] CHOICES = [ + "cls", + "?", "help", "quit", "q", @@ -130,7 +132,8 @@ class TerminalController: """Print help""" help_text = """ What do you want to do? - help help to see this menu again + cls clear screen + ?/help show this menu again update update terminal from remote reset reset terminal and reload configs about about us @@ -198,12 +201,27 @@ Contexts: None - continue in the menu """ + # Empty command + if not an_input: + print("") + return None + if not self.ticker and an_input in self.CHOICES_TICKER_DEPENDENT: print("No ticker selected. Use 'load '.\n") return None (known_args, other_args) = self.t_parser.parse_known_args(an_input.split()) + # Help menu again + if known_args.cmd == "?": + self.print_help() + return None + + # Clear screen + if known_args.cmd == "cls": + os.system("cls||clear") + return None + return getattr( self, "call_" + known_args.cmd, lambda: "Command not recognized!" )(other_args)