diff --git a/gamestonk_terminal/main_helper.py b/gamestonk_terminal/main_helper.py index 0261e231870..7848dc191f4 100644 --- a/gamestonk_terminal/main_helper.py +++ b/gamestonk_terminal/main_helper.py @@ -28,6 +28,7 @@ def print_help(s_ticker, s_start, s_interval, b_is_market_open): """Print help""" print("What do you want to do?") print(" help help to see this menu again") + print(" reset reset terminal and reload configs") print(" quit to abandon the program") print("") print(" clear clear a specific stock ticker from analysis") diff --git a/terminal.py b/terminal.py index 03189c3b1fc..593cc5b0823 100644 --- a/terminal.py +++ b/terminal.py @@ -4,6 +4,7 @@ import argparse import sys import os +import subprocess from datetime import datetime, timedelta import pandas as pd import yfinance as yf @@ -75,6 +76,7 @@ def main(): "help", "quit", "q", + "reset", "clear", "load", "candle", @@ -164,7 +166,11 @@ def main(): if ns_known_args.opt == "help": should_print_help = True - elif (ns_known_args.opt == "quit") or (ns_known_args.opt == "q"): + elif ( + (ns_known_args.opt == "quit") + or (ns_known_args.opt == "q") + or (ns_known_args.opt == "reset") + ): break elif ns_known_args.opt == "clear": @@ -393,7 +399,22 @@ def main(): if not main_cmd: should_print_help = True - print_goodbye() + if not gtff.ENABLE_QUICK_EXIT: + if ns_known_args.opt == "reset": + print("resetting...") + + completed_process = subprocess.run( + "python terminal.py", shell=True, check=False + ) + if completed_process.returncode != 0: + completed_process = subprocess.run( + "python3 terminal.py", shell=True, check=False + ) + if completed_process.returncode != 0: + print("Unfortunately, resetting wasn't possible!\n") + print_goodbye() + else: + print_goodbye() if __name__ == "__main__":