This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_5_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 11129e2ad25ab148d24c06c7eb8a9aae0c0670cd Author: Paul King <[email protected]> AuthorDate: Fri Oct 24 22:36:43 2025 +1000 GROOVY-11791: Support unquoted URLs in groovysh (add example in doco) --- .../src/spec/doc/assets/img/repl_slurp_url.png | Bin 0 -> 126291 bytes subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/subprojects/groovy-groovysh/src/spec/doc/assets/img/repl_slurp_url.png b/subprojects/groovy-groovysh/src/spec/doc/assets/img/repl_slurp_url.png new file mode 100644 index 0000000000..749ab7a864 Binary files /dev/null and b/subprojects/groovy-groovysh/src/spec/doc/assets/img/repl_slurp_url.png differ diff --git a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc index d36f965955..4abc54e8c0 100644 --- a/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc +++ b/subprojects/groovy-groovysh/src/spec/doc/groovysh.adoc @@ -982,12 +982,17 @@ various formats like XML, JSON, YAML, etc. You can use those in your code if you like, but the `/slurp` command can be a convenience shortcut. It supports most of the common formats, including JSON, XML, YAML, CSV, TOML and property files. -image:{reldir_groovysh}/assets/img/repl_slurp.png[Usage of the /slurp command, width=75%] +image:{reldir_groovysh}/assets/img/repl_slurp.png[Usage of the /slurp command, width=80%] As you can see in the usage information at the end of the above image, you can also provide an encoding and a format. If no format is given, `UTF_8` is the default. If no format is given, the shell will try to determine the format from the extension of the file (if given). +If no format or file extension is given, the `/slurp` command makes +a rudimentary attempt to determine the format by looking at the content, +e.g. the json format is determined in the following example: + +image:{reldir_groovysh}/assets/img/repl_slurp_url.png[Usage of the /slurp command with a URL, width=75%] Although the details of the exact object returned are an implementation detail which may change in the future, the current behavior is as follows:
