Script hint : how to specify default value for a parameter in the propertie files or script annotation

@PGriffith or @pturmel

How to specify default value for a parameter in the propertie files or script annotation

my propertie file:

sshShellCommand.desc=shell command with ssh from client to the gateway scope
sshShellCommand.param.host=host
sshShellCommand.param.username=username
sshShellCommand.param.password=password
sshShellCommand.param.port=port (default 22)

script hint:

How is your function defined/what annotations are you using?

I use KeywordArgs parameters:

@ScriptFunction(docBundlePrefix = Constantes.BUNDLE_PREFIX_COMMAND)
@KeywordArgs(names = {"host", "username", "password", "port", "command","grep","promptChar","privateKeyFilePath","passPhrase"},
            types = {String.class,String.class,String.class,Integer.class,String.class,String.class,String.class,String.class,String.class})

There's currently no way to contribute a default argument that will show up in that list. If the arg is detected as 'optional', then it adds that Default: None text, but it's hardcoded to that.

This is a limitation that should be lifted in 8.3; currently autocompletion for system.* functions is re-parsing the HTML text spit out by ScriptFunctionHint. In 8.3, the entire way script hints are provided will be changed to allow direct use of com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor classes, but it's not possible to make that change in a backwards-compatible way, so 8.1 is not going to get that benefit.

1 Like

thanks for those clarifications.