INNER CODE UNIT · Python
get_history_commands
gorilla-llm/gorilla-cli · go_cli.py:202
def get_history_commands(history_file):
"""
Takes in history file
Returns None if file doesn't exist or empty
Returns list of last 10 history commands in the file if it exists
"""
if os.path.isfile(history_file):
with open(history_file, 'r') as history:
lines = history.readlines()
if not lines:
print("No command history.")
return lines[-HISTORY_LENGTH:]
else:
print("No command history.")
return
args = sys.argv[1:]
user_input = " ".join(args)