mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-22 18:06:52 +00:00
Allow "\n" in mlr repl prompt (#1058)
This commit is contained in:
parent
ba349fe66f
commit
bbeeb92a37
4 changed files with 77 additions and 0 deletions
1
README-go-port.md
Normal file
1
README-go-port.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
Moved to [README-dev.md](README-dev.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:
|
||||
|
||||
<pre class="pre-non-highlight-non-pair">
|
||||
$ mlr repl -q
|
||||
> 1+2
|
||||
3
|
||||
> <
|
||||
... func f(x) {
|
||||
... return x**2
|
||||
... }
|
||||
... >
|
||||
> f(99)
|
||||
9801
|
||||
</pre>
|
||||
|
||||
<pre class="pre-non-highlight-non-pair">
|
||||
$ 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
|
||||
</pre>
|
||||
|
||||
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`.
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue