ScriptRunnerShellConfig.parse constructor
ScriptRunnerShellConfig.parse(
- dynamic obj
Parses a shell configuration from a YamlMap
, Map or String.
Other types will throw a ScriptStateError.
Implementation
factory ScriptRunnerShellConfig.parse(dynamic obj) {
try {
if (obj is String) {
return ScriptRunnerShellConfig(defaultShell: obj);
}
if (obj is Map || obj is Map) {
return ScriptRunnerShellConfig(
defaultShell: obj['default'],
windows: obj['windows'],
macos: obj['macos'],
linux: obj['linux'],
);
}
if (obj == null) {
return ScriptRunnerShellConfig();
}
throw ScriptStateError('Invalid shell config: $obj');
} catch (e) {
throw ScriptStateError('Error while parsing config: $obj');
}
}