Accept stdin args for terminal.py

This commit is contained in:
Aaron Cutright
2021-03-18 20:30:31 -04:00
parent 245b34de62
commit 032a11cada

View File

@@ -82,6 +82,7 @@ def main():
# Print first welcome message and help
print("\nWelcome to Gamestonk Terminal 🚀\n")
should_print_help = True
parsed_stdin = False
# Loop forever and ever
while True:
@@ -90,8 +91,12 @@ def main():
print_help(s_ticker, s_start, s_interval, b_is_stock_market_open())
should_print_help = False
# Get input command from user
if session and gtff.USE_PROMPT_TOOLKIT:
# Get input command from stdin or user
if not parsed_stdin and len(sys.argv) > 1:
as_input = " ".join(sys.argv[1:])
parsed_stdin = True
print(f"{get_flair()}> {as_input}")
elif session and gtff.USE_PROMPT_TOOLKIT:
as_input = session.prompt(f"{get_flair()}> ", completer=completer)
else:
as_input = input(f"{get_flair()}> ")