@@ -40,29 +40,27 @@ def print_inputs(tool_name, module=None, function=None):
40
40
tool_outputs = []
41
41
42
42
for name , spec in sorted (interface .inputs .traits (transient = None ).items ()):
43
-
44
- #FIXME: optional inputs are not supported yet
45
- if not ( hasattr (spec , "mandatory" ) and spec .mandatory ):
46
- continue
47
43
48
44
input = {}
45
+
49
46
input ['name' ] = name
50
47
type = spec .full_info (inputs , name , None )
51
- if not "an existing file name" in type :
52
- type = "String "
48
+ if "an existing file name" in type :
49
+ type = "File "
53
50
else :
54
- type = "File "
51
+ type = "String "
55
52
input ['type' ] = type
56
53
input ['description' ] = "\n " .join (interface ._get_trait_desc (inputs , name , spec ))[len (name )+ 2 :].replace ("\n \t \t " ,". " )
57
54
command_line_key = "[" + str (input_counter )+ "_" + name .upper ()+ "]"
58
55
input_counter += 1
59
56
input ['command-line-key' ] = command_line_key
60
57
input ['cardinality' ] = "Single"
61
- tool_inputs .append (input )
62
-
63
- if not ( hasattr (spec , "mandatory" ) and spec .mandatory ):
64
- command_line += "--%s" % name + " " # unreachable code as long as optional inputs are not supported
58
+ if not ( hasattr (spec , "mandatory" ) and spec .mandatory ):
59
+ input ['optional' ] = "true"
60
+ input ['command-line-flag' ] = "--%s" % name + " "
65
61
62
+ tool_inputs .append (input )
63
+
66
64
command_line += command_line_key + " "
67
65
68
66
# add value to input so that output names can be generated
@@ -89,8 +87,7 @@ def print_inputs(tool_name, module=None, function=None):
89
87
output ['value-template' ] = os .path .basename (output_value )
90
88
91
89
output ['cardinality' ] = "Single"
92
- if output ['value-template' ] != "" : # outputs with no templates would certainly crash.
93
- tool_outputs .append (output )
90
+ tool_outputs .append (output )
94
91
95
92
# remove all temporary file names from inputs
96
93
for input in tool_inputs :
@@ -101,7 +98,7 @@ def print_inputs(tool_name, module=None, function=None):
101
98
tool_desc ['command-line' ] = command_line
102
99
tool_desc ['docker-image' ] = 'docker.io/robdimsdale/nipype'
103
100
tool_desc ['docker-index' ] = 'http://index.docker.io'
104
- tool_desc ['schema-version' ] = '0.1 '
101
+ tool_desc ['schema-version' ] = '0.2-snapshot '
105
102
print json .dumps (tool_desc , indent = 4 , separators = (',' , ': ' ))
106
103
107
104
def main (argv ):
0 commit comments