From 5c8360aa909a4b95ee5fae3140903c4b4d4781cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=B6ller?= Date: Tue, 16 Feb 2016 10:49:30 +0100 Subject: [PATCH] Do not ask to select from list with single element A consequence of observations on the simplified hello.cwl and https://github.com/common-workflow-language/workflows/pull/60 . --- cwltool/main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cwltool/main.py b/cwltool/main.py index 72d3a4587..e5eab2d43 100755 --- a/cwltool/main.py +++ b/cwltool/main.py @@ -313,10 +313,13 @@ def load_tool(argsworkflow, updateonly, strict, makeTool, debug, if urifrag: processobj, _ = document_loader.resolve_ref(uri) elif isinstance(processobj, list): - _logger.error("Tool file contains graph of multiple objects, must specify one of #%s", - ", #".join(urlparse.urldefrag(i["id"])[1] - for i in processobj if "id" in i)) - return 1 + if 1 == len(processobj): + processobj = processobj[0] + else: + _logger.error("Tool file contains graph of multiple objects, must specify one of #%s", + ", #".join(urlparse.urldefrag(i["id"])[1] + for i in processobj if "id" in i)) + return 1 try: t = makeTool(processobj, strict=strict, makeTool=makeTool, loader=document_loader, avsc_names=avsc_names)