* minor refactoring
This commit is contained in:
parent
1d9890dc40
commit
3339dc36d1
|
@ -77,7 +77,7 @@ public class Main {
|
|||
System.out.format("%s / %s%n%n", getApplicationIdentifier(), getJavaRuntimeIdentifier());
|
||||
|
||||
if (args.printHelp() || (!args.printVersion() && isHeadless())) {
|
||||
ArgumentBean.printHelp(args);
|
||||
ArgumentBean.printHelp(args, System.out);
|
||||
}
|
||||
|
||||
// just print help message or version string and then exit
|
||||
|
|
|
@ -5,6 +5,7 @@ import static java.util.Collections.*;
|
|||
import static net.sourceforge.filebot.util.FileUtilities.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
@ -120,7 +121,7 @@ public class ArgumentBean {
|
|||
public boolean help = false;
|
||||
|
||||
@Option(name = "--def", usage = "Define script variables", handler = BindingsHandler.class)
|
||||
public Map<String, String> bindings = new LinkedHashMap<String, String>();
|
||||
public Map<String, String> defines = new LinkedHashMap<String, String>();
|
||||
|
||||
@Argument
|
||||
public List<String> arguments = new ArrayList<String>();
|
||||
|
@ -199,8 +200,8 @@ public class ArgumentBean {
|
|||
return bean;
|
||||
}
|
||||
|
||||
public static void printHelp(ArgumentBean argumentBean) {
|
||||
new CmdLineParser(argumentBean).printUsage(System.out);
|
||||
public static void printHelp(ArgumentBean argumentBean, OutputStream out) {
|
||||
new CmdLineParser(argumentBean).printUsage(out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class ArgumentProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
ScriptShell shell = new ScriptShell(scriptProvider, args.bindings);
|
||||
ScriptShell shell = new ScriptShell(scriptProvider, args.defines);
|
||||
shell.runScript(script, bindings);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ public class ScriptShell {
|
|||
|
||||
CompilerConfiguration config = new CompilerConfiguration();
|
||||
config.setScriptBaseClass(bundle.getString("scriptBaseClass"));
|
||||
config.setRecompileGroovySource(false);
|
||||
config.setDebug(false);
|
||||
|
||||
// default imports
|
||||
ImportCustomizer imports = new ImportCustomizer();
|
||||
|
|
|
@ -39,7 +39,7 @@ public abstract class ScriptShellBaseClass extends Script {
|
|||
|
||||
// define global variable: _def
|
||||
public Map<String, String> get_def() {
|
||||
return getApplicationArguments().bindings;
|
||||
return getApplicationArguments().defines;
|
||||
}
|
||||
|
||||
// define global variable: _system
|
||||
|
|
Loading…
Reference in New Issue