This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new fee538c8fc GROOVY-8162: Update Groovysh to JLine3 (documentation for
/pipe)
fee538c8fc is described below
commit fee538c8fc75f71e6d2bb7790debb542640419ac
Author: Paul King <[email protected]>
AuthorDate: Wed Aug 13 21:52:20 2025 +1000
GROOVY-8162: Update Groovysh to JLine3 (documentation for /pipe)
---
.../groovy-groovysh/src/spec/doc/groovysh.adoc | 26 +++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc
b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc
index 0d2f7a0ae6..3c6466083c 100644
--- a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc
+++ b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc
@@ -593,7 +593,7 @@ image:assets/img/repl_inspect_gui.png[Usage of the /inspect
command, width=80%]
Display the contents of a file (usually a page at a time).
Formatting of common file types is supported.
-image:assets/img/repl_less.png[Usage of the /less command, width=85%]
+image:assets/img/repl_less.png[Usage of the /less command, width=90%]
If no filename is given, the contents of the current buffer are displayed.
@@ -669,6 +669,30 @@ as these examples show:
image:assets/img/repl_pipe.png[usage of the /pipe command, width=70%]
+JLine functionality includes support for named pipes and pipe aliases:
+
+[source,jshell]
+----
+groovy> /pipe smallFruit '.findAll{ it.size() <' '}'
+groovy> fruit | smallFruit 6
+[apple, date]
+groovy> /alias sizes '|. it.size()'
+groovy> fruit | sizes
+[5, 6, 6, 4, 10]
+----
+
+These should be regarded as incubating features, as we are still
+exploring the possibility of an alternative syntax to use for the Groovy Shell,
+since the pipe operator conflicts with the binary OR operator.
+In the meantime, bracketed expressions aren't searched for pipe operators,
+so that provides a workaround for the conflict:
+
+[source,jshell]
+----
+groovy> (4 | 8)
+12
+----
+
There is another less commonly used builtin pipe operator, `|;`, which is used
to flip arguments:
[source,jshell]