support custom groovy scripts (via files)
This commit is contained in:
parent
62238e507e
commit
dbcddd02e3
|
@ -232,17 +232,22 @@ public class ArgumentBean {
|
|||
return files;
|
||||
}
|
||||
|
||||
public RenameAction getRenameAction() {
|
||||
public RenameAction getRenameAction() throws Exception {
|
||||
// support custom executables (via absolute path)
|
||||
if (action.startsWith("/")) {
|
||||
return new ExecutableRenameAction(action, getOutputPath());
|
||||
}
|
||||
|
||||
// support custom groovy scripts (via closures)
|
||||
if (action.startsWith("{")) {
|
||||
if (action.startsWith("{") || action.endsWith("}")) {
|
||||
return new GroovyRenameAction(action);
|
||||
}
|
||||
|
||||
// support custom groovy scripts (via files)
|
||||
if (action.endsWith(".groovy")) {
|
||||
return new GroovyRenameAction(readTextFile(new File(action)));
|
||||
}
|
||||
|
||||
return StandardRenameAction.forName(action);
|
||||
}
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ public abstract class ScriptShellBaseClass extends Script {
|
|||
return map;
|
||||
}
|
||||
|
||||
private RenameAction getRenameAction(Map<String, ?> parameters) {
|
||||
private RenameAction getRenameAction(Map<String, ?> parameters) throws Exception {
|
||||
return consumeParameter(parameters, "action").map(action -> {
|
||||
return getRenameAction(action);
|
||||
}).findFirst().orElse(getArgumentBean().getRenameAction()); // default to global rename action
|
||||
|
|
Loading…
Reference in New Issue