Skip to content

Commit 4f1a3d7

Browse files
committed
Add \c support
1 parent 8ee014b commit 4f1a3d7

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

solutions/rakudo/Configurable-REPL.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,39 @@ Each which supports the following interpolations:
1616
| Sequence | Prompt Expansion |
1717
|--|--|
1818
| `\a` | alert / bell character |
19+
| `\c` | color - see below for options |
1920
| `\e` | escape character |
2021
| `\i` | index - the current iteration of the REPL, which can be referred to later as, e.g. `$*1` |
2122
| `\l` | `$*RAKU.version` |
2223
| `\L` | `$*RAKU.gist` |
2324
| `\n` | newline |
24-
| `\t` | time - see below for more options |
25+
| `\t` | time - see below for options |
2526
| `\v` | `$*RAKU.compiler.version` |
2627
| `\V` | `$*RAKU.gist` |
2728

28-
The escape character allows us to generate ANSI colors, e.g.
29+
## \c formatting
30+
31+
Provide some common ANSI codes with short names. Defaults to `reset` if a bare `\c` is used,
32+
and multiple arguments can be separated with a `;`, e.g.
2933

3034
```
31-
RAKUDO_REPL_PROMPT='[\e[0;31m\i\e[0m] >'
35+
\c{bold;red}
3236
```
3337

34-
Would generate a prompt similar to the default except the index would appear in red.
38+
### formatting
39+
40+
> reset, normal, bold, dim, italic, underline, blink, inverse, hiddne, strikethrough
41+
42+
### foreground colors
43+
44+
> black, red, green, yellow, blue, magenta, cyan, white, default
45+
46+
### background colors
47+
48+
> bg:black, bg:red, bg:green, bg:yellow, bg:blue, bg:magenta, bg:cyan, bg:white, bg:default
49+
50+
Not all escape sequences have aliases - you can always use
51+
`\e` to manually generate codes.
3552

3653
## \t formatting
3754

@@ -55,7 +72,6 @@ Would generate a prompt containing, e.g. `06:18 > `
5572

5673
# Future Development
5774

58-
* Support for colors directly - needs a list of ANSI codes/colors in core.
5975
* More strftime support - perhaps even invoking it directly instead of manually mapping.
6076
* Support `RAKUDO_REPL_COMMAND` to support arbitrary code invocation
6177

0 commit comments

Comments
 (0)