Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit 0404559

Browse files
authored
Merge pull request #5 from EiffL/master
Adds export of arguments in command line tool
2 parents f002b88 + aedd2eb commit 0404559

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
test/__pycache__
22
cwlgen/__pycache__
33
doc/build/
4+
.ropeproject/
5+
build/
6+
cwlgen.egg*
7+
dist/

cwlgen/__init__.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ def export(self, outfile=None):
101101
# Treat doc for multiline writting
102102
if self.doc:
103103
cwl_tool['doc'] = literal(self.doc)
104+
105+
# Add Arguments
106+
cwl_tool['arguments'] = [in_arg.get_dict() for in_arg in self.arguments]
107+
104108
# Add Inputs
105109
cwl_tool['inputs'] = {}
106110
for in_param in self.inputs:
@@ -128,7 +132,7 @@ def export(self, outfile=None):
128132

129133
if requirements:
130134
cwl_tool['requirements'] = requirements
131-
135+
132136
# Write CWL file in YAML
133137
if outfile is None:
134138
six.print_(CWL_SHEBANG, "\n", sep='')
@@ -293,8 +297,8 @@ class CommandLineBinding(object):
293297
Describes how the handle an input or an argument.
294298
'''
295299

296-
def __init__(self, load_contents=False, position=None, prefix=None, separate=False,
297-
item_separator=None, value_from=None, shell_quote=False):
300+
def __init__(self, load_contents=False, position=None, prefix=None, separate=True,
301+
item_separator=None, value_from=None, shell_quote=True):
298302
'''
299303
:param load_contents: Read up to the fist 64 KiB of text from the file and
300304
place it in the "contents" field of the file object
@@ -327,7 +331,7 @@ def get_dict(self):
327331
:return: dictionnary of the object
328332
:rtype: DICT
329333
'''
330-
dict_binding = {k: v for k, v in vars(self).items() if v is not None and v is not False}
334+
dict_binding = {k: v for k, v in vars(self).items() if v is not None}
331335
return dict_binding
332336

333337

@@ -427,7 +431,7 @@ def __init__(self, docker_pull=None, docker_load=None, docker_file=None,
427431

428432
def _to_dict(self):
429433
"""
430-
Add this requirement to a dictionary description of a
434+
Add this requirement to a dictionary description of a
431435
tool generated in an export method.
432436
433437
"""

0 commit comments

Comments
 (0)