-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rakudo REPL’s prompt not configurable #459
Comments
Initial proposal: The prompt should be configurable through an environment variable. On the Raku IRC channel, @coke suggested naming that variable It would also be quite practical to provide a set of pre-defined building blocks for the standard or most frequently needed prompt components, sort of like Bash does. A comfortable way to add color to the prompt that doesn’t require the user to construct cryptic and brittle ANSI escape sequences would also be helpful. |
The |
Started a POC in rakudo's repo on coke/ps1 - Will play for a bit to see what's feasible and followup here with a proposal |
I have a naive version at https://github.com/rakudo/rakudo/blob/coke/ps1/src/core.c/REPL.rakumod#L411-L422 with simplistic backslash substitution - \e is supported, so we can do manual escape sequences for coloring/bold; there is RAKUDO_REPL_PROMPT for the main prompt and RAKUDO_REPL_PROMPT2 for the secondary (both support all substitutions). |
The Rakudo REPL’s prompt consists of a result number in square brackets followed by a space character, a closing angle bracket, and another space character. Currently, there is no way to customize this prompt at runtime.
So, if, e.g., you are testing code examples in the REPL and then want to put the code and results into your notebook or share them with others, but without the result count included (because it doesn’t serve any meaningful purpose in your use case), you will have do extra work to remove it.
There are probably a couple of other good reasons to have a run-time configurable prompt, e. g., adding other bits of information or color to it in order to distinguish between several REPLs running in parallel.
The text was updated successfully, but these errors were encountered: