Skip to content

Commit 81a6e9e

Browse files
authored
Merge pull request #402 from tom-tan/print-cwl-versions
Add --print-supported-versions option that prints supported CWL versions
2 parents 0eb42ff + 448ed81 commit 81a6e9e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cwltool/main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from .resolver import tool_resolver, ga4gh_tool_registries
3131
from .stdfsaccess import StdFsAccess
3232
from .mutation import MutationManager
33+
from .update import UPDATES, ALLUPDATES
3334

3435
_logger = logging.getLogger("cwltool")
3536

@@ -129,6 +130,7 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
129130
exgroup.add_argument("--pack", action="store_true", help="Combine components into single document and print.")
130131
exgroup.add_argument("--version", action="store_true", help="Print version and exit")
131132
exgroup.add_argument("--validate", action="store_true", help="Validate CWL document only.")
133+
exgroup.add_argument("--print-supported-versions", action="store_true", help="Print supported CWL specs.")
132134

133135
exgroup = parser.add_mutually_exclusive_group()
134136
exgroup.add_argument("--strict", action="store_true",
@@ -577,6 +579,14 @@ def versionstring():
577579
else:
578580
return u"%s %s" % (sys.argv[0], "unknown version")
579581

582+
def supportedCWLversions(enable_dev):
583+
# type: (bool) -> List[Text]
584+
if enable_dev:
585+
versions = ALLUPDATES.keys()
586+
else:
587+
versions = UPDATES.keys()
588+
versions.sort()
589+
return versions
580590

581591
def main(argsl=None, # type: List[str]
582592
args=None, # type: argparse.Namespace
@@ -652,6 +662,10 @@ def main(argsl=None, # type: List[str]
652662
else:
653663
_logger.info(versionfunc())
654664

665+
if args.print_supported_versions:
666+
print("\n".join(supportedCWLversions(args.enable_dev)))
667+
return 0
668+
655669
if not args.workflow:
656670
if os.path.isfile("CWLFile"):
657671
setattr(args, "workflow", "CWLFile")

0 commit comments

Comments
 (0)