scijava-common icon indicating copy to clipboard operation
scijava-common copied to clipboard

Add convenience method to retrieve ScriptInfo/ModuleInfo from script

Open imagejan opened this issue 5 years ago • 2 comments

As suggested by @ctrueden on gitter, we should add a convenience method to ScriptService that returns a ScriptInfo or ModuleInfo for a given script.

Something like getScriptInfo(String filename, String script) ?

imagejan avatar Jun 16 '20 20:06 imagejan

As we have:

https://github.com/scijava/scijava-common/blob/dc8ea6d88071d02740ec8e707c9e2cd2cc1ce53c/src/main/java/org/scijava/script/ScriptService.java#L124-L128

already, we might want to keep it consistent and overload the getScript method like this:

/**
 * Creates the {@link ScriptInfo} metadata for the provided script.
 */
ScriptInfo getScript(String languageExtension, String script);

Would you be fine with that, @ctrueden? I can submit a PR updating ScriptService and DefaultScriptService then.

imagejan avatar Jun 18 '20 09:06 imagejan

Sounds good, @imagejan! :+1:

ctrueden avatar Jun 18 '20 21:06 ctrueden