Prompt: Added a prompt (Still buggy a little if it contains dollarsigns)

This commit is contained in:
Sekulum Forka 2021-05-16 16:47:09 +02:00
parent ef34936d29
commit 0d8354ddd9
1 changed files with 4 additions and 0 deletions

View File

@ -371,9 +371,13 @@ when isMainModule:
# ctrlc handler
setControlCHook(ctrlc)
let stdinstrm = stdin.newFileStream
# Set the default prompt
shellVariables["PROMPT"] = "$PWD \\$"
stdout.write(shellVariables["PROMPT"].newStringStream.substitute)
while not stdinstrm.atEnd():
try:
discard stdinstrm.readCommand.execute
stdout.write(shellVariables["PROMPT"].newStringStream.substitute)
except ShellError, ShellCommandError, ShellVariableError:
let e = getCurrentException()
stderr.write(e.msg, "\n")