[MGNLGROOVY-15] Support multi-line scripts in console Created: 01/Feb/10  Updated: 21/Oct/14  Resolved: 16/Oct/14

Status: Closed
Project: Magnolia Groovy Module
Component/s: console
Affects Version/s: 1.0
Fix Version/s: 2.3.1

Type: Improvement Priority: Major
Reporter: Magnolia International Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: next, support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Date of First Response:

 Description   

If I try to write a script such as

visitor = {node ->
  println(node.handle)
}

ContentUtil.visit(root, visitor as ContentUtil.Visitor, new NodeTypeFilter(ItemType.CONTENT))

, it fails, because it tries to execute the script line by line. It would be good if we supported multi-line, one way or another (shift-enter does not submit, or defered execution, or...)



 Comments   
Comment by Federico Grilli [ 16/Oct/14 ]

For the release notes/documentation
When in the console's multi-line editing mode, you can treat blocks of text as similar if you were using a text editor. Shift + Enter allows you enter multi-line mode in the console.
This can be particularly helpful when writing Groovy that is more complex than a simple one-liner. Once you've entered a block of text, press Enter at the end of the command and it should run.

Generated at Mon Feb 12 05:54:44 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.