diff --git a/README-go-port.md b/README-go-port.md new file mode 100644 index 000000000..c8c084370 --- /dev/null +++ b/README-go-port.md @@ -0,0 +1 @@ +Moved to [README-dev.md](README-dev.md). diff --git a/docs/src/repl.md b/docs/src/repl.md index eea5f4cb9..71de28b33 100644 --- a/docs/src/repl.md +++ b/docs/src/repl.md @@ -282,6 +282,43 @@ etc. depending on your platform. Suggestion: `alias mrpl='rlwrap mlr repl'` in your shell's startup file. +## Customization + +In your shell environment you can set the `MLR_REPL_PS1` and `MLR_REPL_PS2` environment variables if you like: + +
+$ mlr repl -q
+> 1+2
+3
+> <
+... func f(x) {
+... return x**2
+... }
+... >
+> f(99)
+9801
+
+
+
+$ export MLR_REPL_PS1='\nMLR REPL> '
+$ export MLR_REPL_PS2=' '
+$ mlr repl -q
+
+MLR REPL> 1+2
+3
+
+MLR REPL> <
+ func f(x) {
+ return x**2
+ }
+ >
+
+MLR REPL> f(99)
+9801
+
+
+See also `MLR_REPL_PS1_COLOR` on the [output-colorization page](output-colorization.md).
+
## Online help
After `mlr repl`, type `:help` to see more about your options. In particular, `:help examples`.
diff --git a/docs/src/repl.md.in b/docs/src/repl.md.in
index 4ef3e7657..b434a2f2d 100644
--- a/docs/src/repl.md.in
+++ b/docs/src/repl.md.in
@@ -228,6 +228,43 @@ etc. depending on your platform.
Suggestion: `alias mrpl='rlwrap mlr repl'` in your shell's startup file.
+## Customization
+
+In your shell environment you can set the `MLR_REPL_PS1` and `MLR_REPL_PS2` environment variables if you like:
+
+GENMD-CARDIFY
+$ mlr repl -q
+> 1+2
+3
+> <
+... func f(x) {
+... return x**2
+... }
+... >
+> f(99)
+9801
+GENMD-EOF
+
+GENMD-CARDIFY
+$ export MLR_REPL_PS1='\nMLR REPL> '
+$ export MLR_REPL_PS2=' '
+$ mlr repl -q
+
+MLR REPL> 1+2
+3
+
+MLR REPL> <
+ func f(x) {
+ return x**2
+ }
+ >
+
+MLR REPL> f(99)
+9801
+GENMD-EOF
+
+See also `MLR_REPL_PS1_COLOR` on the [output-colorization page](output-colorization.md).
+
## Online help
After `mlr repl`, type `:help` to see more about your options. In particular, `:help examples`.
diff --git a/internal/pkg/auxents/repl/prompt.go b/internal/pkg/auxents/repl/prompt.go
index c4c4a4a76..7c0341881 100644
--- a/internal/pkg/auxents/repl/prompt.go
+++ b/internal/pkg/auxents/repl/prompt.go
@@ -37,6 +37,7 @@ func getPrompt1() string {
if prompt1 == "" {
prompt1 = DEFAULT_PRIMARY_PROMPT
}
+ prompt1 = lib.UnbackslashStringLiteral(prompt1) // In case they want a "\n" in there
return colorizer.MaybeColorizeREPLPS1(prompt1, true)
}
@@ -45,6 +46,7 @@ func getPrompt2() string {
if prompt2 == "" {
prompt2 = DEFAULT_SECONDARY_PROMPT
}
+ prompt2 = lib.UnbackslashStringLiteral(prompt2) // In case they want a "\n" in there
return colorizer.MaybeColorizeREPLPS2(prompt2, true)
}