-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Configurable REPL Prompt | ||
|
||
The default REPL for Rakudo is not configurable. | ||
|
||
# Proposed Solution | ||
|
||
Implement support for two environment variables: | ||
|
||
| Variable | Description | | ||
|--|--| | ||
| `RAKUDO_REPL_PROMPT` | the main prompt | | ||
| `RAKUDO_REPL_PROMPT2` | the continuation prompt | | ||
|
||
Each which supports the following interpolations: | ||
|
||
| Backslash | Meaning | | ||
|--|--| | ||
| `\a` | alert / bell character | | ||
| `\e` | escape character | | ||
| `\i` | index - the current iteration of the REPL, which can be referred to later as, e.g. `$*1` | | ||
| '\l' | `$*RAKU.version` | | ||
| '\L' | `$*RAKU..gist` | | ||
| `\t` | time - see below for more options | | ||
| '\v' | `$*RAKU.compiler.version` | | ||
| '\V' | `$*RAKU.gistt` | | ||
|
||
The escape character allows us to generate ANSI colors, e.g. | ||
|
||
`RAKUDO_REPL_PROMPT='[\e[0;31m\i\e[0m] >' | ||
|
||
Would generate a prompt similar to the default except the index would appear in red. | ||
|
||
## \t formatting | ||
|
||
The '\t' construct takes an optional set of '{}' containing a subset of `strftime` codes, | ||
defaulting to %T if a bare `\t` is used. | ||
|
||
| Code | Value | | ||
|--|--| | ||
| `%T` | `%H:%M:%S` | | ||
| `%R` | `%H:%M` | | ||
| `%H` | 24-Hour hours, 2 digits | | ||
| `%I` | 12-hour hours, 2 digits | | ||
| `%M` | minutes, 2 digits | | ||
| `%S` | seconds, 2 digits | | ||
|
||
# Future Development | ||
|
||
* Support for colors directly - needs a list of ANSI codes/colors in core. | ||
* More strftime support - perhaps even invoking it directly instead of manually mapping. | ||
* Support `RAKUDO_REPL_COMMAND` to support arbitrary code invocation | ||
|
||
|
||
|