@@ -39,7 +39,7 @@ def __init__(self, tool_id=None, base_command=None, label=None, doc=None,
39
39
:param tool_id: unique identifier for this tool
40
40
:type tool_id: STRING
41
41
:param base_command: command line for the tool
42
- :type base_command: STRING
42
+ :type base_command: STRING | list[STRING]
43
43
:param label: label of this tool
44
44
:type label: STRING
45
45
:param doc: documentation for the tool, usually longer than the label
@@ -82,19 +82,17 @@ def __init__(self, tool_id=None, base_command=None, label=None, doc=None,
82
82
self ._path = path
83
83
self .namespaces = Namespaces ()
84
84
85
- def export (self , outfile = None ):
86
- """
87
- Export the tool in CWL either on STDOUT or in outfile.
88
- """
89
- # First add representer (see .utils.py) for multiline writting
90
- ruamel .yaml .add_representer (literal , literal_presenter )
85
+ def get_dict (self ):
91
86
cwl_tool = {k : v for k , v in vars (self ).items () if v is not None and
92
87
type (v ) is str }
93
88
cwl_tool ['class' ] = self .__CLASS__
94
89
# Treat doc for multiline writting
95
90
if self .doc :
96
91
cwl_tool ['doc' ] = literal (self .doc )
97
92
93
+ if self .baseCommand :
94
+ cwl_tool ['baseCommand' ] = self .baseCommand
95
+
98
96
# Add Arguments
99
97
cwl_tool ['arguments' ] = [in_arg .get_dict () for in_arg in self .arguments ]
100
98
@@ -108,6 +106,13 @@ def export(self, outfile=None):
108
106
for out_param in self .outputs :
109
107
cwl_tool ['outputs' ][out_param .id ] = out_param .get_dict ()
110
108
109
+ if self .successCodes :
110
+ cwl_tool ['successCodes' ] = self .successCodes
111
+ if self .temporaryFailCodes :
112
+ cwl_tool ['temporaryFailCodes' ] = self .temporaryFailCodes
113
+ if self .permanentFailCodes :
114
+ cwl_tool ['permanentFailCodes' ] = self .permanentFailCodes
115
+
111
116
# If metadata are present in the description
112
117
if getattr (self , 'metadata' , None ):
113
118
for key , value in self .metadata .__dict__ .items ():
@@ -125,6 +130,15 @@ def export(self, outfile=None):
125
130
126
131
if requirements :
127
132
cwl_tool ['requirements' ] = requirements
133
+ return cwl_tool
134
+
135
+ def export (self , outfile = None ):
136
+ """
137
+ Export the tool in CWL either on STDOUT or in outfile.
138
+ """
139
+ # First add representer (see .utils.py) for multiline writting
140
+ ruamel .yaml .add_representer (literal , literal_presenter )
141
+ cwl_tool = self .get_dict ()
128
142
129
143
# Write CWL file in YAML
130
144
if outfile is None :
0 commit comments