fmartingr
/
jeeves
Archived
1
0
Fork 0

contrib/script: Allow parameters

This commit is contained in:
Felipe Martin 2020-04-29 21:01:58 +02:00
parent a01645a1c8
commit f3b5235658
Signed by: fmartingr
GPG Key ID: 716BC147715E716F
1 changed files with 5 additions and 3 deletions

View File

@ -35,6 +35,7 @@ class ScriptAction(Action):
| ``script`` | text | yes | The script to be executed | | ``script`` | text | yes | The script to be executed |
+----------------+------+-----------+---------------------------+ +----------------+------+-----------+---------------------------+
""" """
PARSE_WITH_ARGUMENTS = {"script"}
script: Text script: Text
@ -44,9 +45,10 @@ class ScriptAction(Action):
If no shebang is defined, :any:`ScriptAction.DEFAULT_SHEBANG` with be used. If no shebang is defined, :any:`ScriptAction.DEFAULT_SHEBANG` with be used.
""" """
if not self.parameters.script.startswith("#!"): script = self.parsed_parameters["script"]
return f"{self.DEFAULT_SHEBANG}{os.linesep}{self.parameters.script}" if not script.startswith("#!"):
return self.parameters.script return f"{self.DEFAULT_SHEBANG}{os.linesep}{script}"
return script
def execute(self, **kwargs): def execute(self, **kwargs):
workspace = kwargs.get("workspace") workspace = kwargs.get("workspace")