INNER CODE UNIT · Python
format_command
gorilla-llm/gorilla-cli · go_cli.py:160
def format_command(input_str):
"""
Standardize commands to be stored with a newline
character in the history
"""
if not input_str.endswith('\n'):
input_str += '\n'
return input_str
def append_string_to_file_if_missing(file_path, target_string):
"""
Don't append command to history file if it already exists.
"""
try:
with open(file_path, 'r') as file:
lines = file.readlines()
# Check if the target string is already in the file