willghatch / racket-rash

The Reckless Racket Shell
http://rash-lang.org
Other
547 stars 32 forks source link

Get the exit code of the last command #94

Closed LordMZTE closed 1 year ago

LordMZTE commented 1 year ago

I'd like to integrate the exit code of the previous command into my prompt, but I currently can't find any functions to get it, or any information that allows me to tell whether the last command ran was successful.

willghatch commented 1 year ago

There are optional keyword arguments for the prompt function. When displaying the prompt, the Rash repl tests the prompt function's keyword arity to see which of the arguments to apply. So you can add the #:last-return-value keyword to get it. See this documentation: https://docs.racket-lang.org/rash/index.html#%28def._%28%28lib._rash%2Fmain..rkt%29._current-prompt-function%29%29

LordMZTE commented 1 year ago

Thanks! I Must've missed that!