fix: add clearScreen function and handle exceptions in systemCommand
This commit is contained in:
parent
a8136a7ff4
commit
9da95ee850
@ -19,15 +19,23 @@ def clearCondition(command: str) -> bool:
|
||||
return command in ["c", "clear", "cls"]
|
||||
|
||||
|
||||
def clearScreen():
|
||||
print(run_command("clear"))
|
||||
return None
|
||||
|
||||
|
||||
def systemCommand(command: str) -> str:
|
||||
words = command[1:].split()
|
||||
if words[0] == "":
|
||||
return "Command not found. Write 'h' for help."
|
||||
try:
|
||||
print(
|
||||
run_command(
|
||||
f'docker exec -it webscraper {" ".join(words)}',
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
return None
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ def prompt():
|
||||
print(help_list())
|
||||
continue
|
||||
if clearCondition(command):
|
||||
run_command("clear")
|
||||
clearScreen()
|
||||
continue
|
||||
if command.startswith("$"):
|
||||
systemCommand(command)
|
||||
|
Loading…
Reference in New Issue
Block a user