@@ -65,24 +65,21 @@ class RunnableScript {
6565 }) : _fileSystem = fileSystem ?? LocalFileSystem ();
6666
6767 /// Generate a runnable script from a yaml loaded map as defined in the config.
68- factory RunnableScript .fromYamlMap (yaml.YamlMap map,
69- {FileSystem ? fileSystem}) {
68+ factory RunnableScript .fromYamlMap (yaml.YamlMap map, {FileSystem ? fileSystem}) {
7069 final out = < String , dynamic > {};
7170
7271 if (map['name' ] == null && map.keys.length == 1 ) {
7372 out['name' ] = map.keys.first;
7473 out['cmd' ] = map.values.first;
7574 } else {
7675 out.addAll (map.cast <String , dynamic >());
77- out['args' ] =
78- (map['args' ] as yaml.YamlList ? )? .map ((e) => e.toString ()).toList ();
76+ out['args' ] = (map['args' ] as yaml.YamlList ? )? .map ((e) => e.toString ()).toList ();
7977 out['env' ] = (map['env' ] as yaml.YamlMap ? )? .cast <String , String >();
8078 }
8179 try {
8280 return RunnableScript .fromMap (out, fileSystem: fileSystem);
8381 } catch (e) {
84- throw StateError (
85- 'Failed to parse script, arguments: $map , $fileSystem . Error: $e ' );
82+ throw StateError ('Failed to parse script, arguments: $map , $fileSystem . Error: $e ' );
8683 }
8784 }
8885
@@ -112,8 +109,7 @@ class RunnableScript {
112109 appendNewline: appendNewline,
113110 );
114111 } catch (e) {
115- throw StateError (
116- 'Failed to parse script, arguments: $map , $fileSystem . Error: $e ' );
112+ throw StateError ('Failed to parse script, arguments: $map , $fileSystem . Error: $e ' );
117113 }
118114 }
119115
@@ -175,8 +171,7 @@ class RunnableScript {
175171 return exitCode;
176172 }
177173
178- String _getScriptPath () => _fileSystem.path
179- .join (_fileSystem.systemTempDirectory.path, 'script_runner_$name .sh' );
174+ String _getScriptPath () => _fileSystem.path.join (_fileSystem.systemTempDirectory.path, 'script_runner_$name .sh' );
180175
181176 String _getScriptContents (
182177 ScriptRunnerConfig config, {
@@ -192,12 +187,8 @@ class RunnableScript {
192187 ].join ('\n ' );
193188 case OS .linux:
194189 case OS .macos:
195- return [
196- ...preloadScripts.map ((e) =>
197- "[[ ! \$ (which ${e .name }) ]] && alias ${e .name }='scr ${e .name }'" ),
198- script
199- ].join ('\n ' );
190+ return [...preloadScripts.map ((e) => "[[ ! \$ (which ${e .name }) ]] && alias ${e .name }='scr ${e .name }'" ), script]
191+ .join ('\n ' );
200192 }
201193 }
202194}
203-
0 commit comments