@@ -40,29 +40,27 @@ def print_inputs(tool_name, module=None, function=None):
4040 tool_outputs = []
4141
4242 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
4743
4844 input = {}
45+
4946 input ['name' ] = name
5047 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 "
5350 else :
54- type = "File "
51+ type = "String "
5552 input ['type' ] = type
5653 input ['description' ] = "\n " .join (interface ._get_trait_desc (inputs , name , spec ))[len (name )+ 2 :].replace ("\n \t \t " ,". " )
5754 command_line_key = "[" + str (input_counter )+ "_" + name .upper ()+ "]"
5855 input_counter += 1
5956 input ['command-line-key' ] = command_line_key
6057 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 + " "
6561
62+ tool_inputs .append (input )
63+
6664 command_line += command_line_key + " "
6765
6866 # add value to input so that output names can be generated
@@ -89,8 +87,7 @@ def print_inputs(tool_name, module=None, function=None):
8987 output ['value-template' ] = os .path .basename (output_value )
9088
9189 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 )
9491
9592 # remove all temporary file names from inputs
9693 for input in tool_inputs :
0 commit comments