Skip to content

Commit

Permalink
definitions key: stop at square bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 9, 2023
1 parent c7fe241 commit ff783fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Expand Up @@ -2275,6 +2275,10 @@ else if (value > 0) {
for (String definition : definitions) {
String name = definition_names != null && definition_names.length >= x ?
definition_names[x - 1].trim() : String.valueOf(x);
int squareBracket = name.indexOf('[');
if (squareBracket != -1) {
name = name.substring(0, squareBracket).trim();
}
queue.addDefinition(name, definition);
Debug.echoDebug(entries.get(0), "Adding definition '" + name + "' as " + definition);
x++;
Expand Down
Expand Up @@ -30,7 +30,8 @@ public class TaskScriptContainer extends ScriptContainer {
//
// # When intending to run a task script via the run command with the "def:" argument to pass data through,
// # use this "definitions" key to specify the names of the definitions (in the same order as the "def:" argument will use).
// definitions: name1|name2|...
// # You can optionally document a definition with [square brackets]
// definitions: name1|name2[description here]|...
//
// script:
//
Expand Down
Expand Up @@ -93,6 +93,10 @@ public static ScriptQueue createAndStartQueue(ScriptContainer container, String
int x = 1;
for (ObjectTag definition : definitions.objectForms) {
String name = definition_names != null && definition_names.size() >= x ? definition_names.get(x - 1).trim() : String.valueOf(x);
int squareBracket = name.indexOf('[');
if (squareBracket != -1) {
name = name.substring(0, squareBracket).trim();
}
queue.addDefinition(name, definition);
if (debugDefinitions != null && debugDefinitions.shouldDebug()) {
Debug.echoDebug(debugDefinitions, "Adding definition '" + name + "' as " + definition);
Expand Down

0 comments on commit ff783fc

Please sign in to comment.