diff --git a/cwltool/main.py b/cwltool/main.py index 1c502c508..9ea819598 100755 --- a/cwltool/main.py +++ b/cwltool/main.py @@ -285,8 +285,13 @@ def generate_parser(toolparser, tool, namemap): _logger.debug(u"Can't make command line argument from %s", inptype) return None + if inptype != "boolean": + typekw = { 'type': atype } + else: + typekw = {} + toolparser.add_argument(flag + name, required=required, - help=ahelp, action=action, type=atype, default=default) + help=ahelp, action=action, default=default, **typekw) return toolparser diff --git a/tests/test_toolargparse.py b/tests/test_toolargparse.py index 7504280ed..29bfeb34c 100644 --- a/tests/test_toolargparse.py +++ b/tests/test_toolargparse.py @@ -24,6 +24,24 @@ class ToolArgparse(unittest.TestCase): glob: test.txt stdout: test.txt baseCommand: [cat] +''' + + script2=''' +#!/usr/bin/env cwl-runner +cwlVersion: 'cwl:draft-3' +class: CommandLineTool +inputs: + - id: bdg + type: "boolean" +outputs: + - id: output + type: File + outputBinding: + glob: foo +baseCommand: + - echo + - "ff" +stdout: foo ''' def test_help(self): @@ -31,3 +49,12 @@ def test_help(self): f.write(self.script) f.flush() self.assertEquals(main([f.name, '--input', 'README.rst']), 0) + + def test_bool(self): + with NamedTemporaryFile() as f: + f.write(self.script2) + f.flush() + try: + self.assertEquals(main([f.name, '--help']), 0) + except SystemExit as e: + self.assertEquals(e.code, 0)