Skip to content

Commit 1eb437a

Browse files
committed
Added argcomplete
1 parent 2cec4ee commit 1eb437a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cwltool/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
"""Entry point for cwltool."""
33

4+
import argcomplete
45
import argparse
56
import functools
67
import io
@@ -100,7 +101,7 @@
100101
windows_default_container_id,
101102
)
102103
from .workflow import Workflow
103-
104+
# PYTHON_ARGCOMPLETE_OK
104105

105106
def _terminate_processes() -> None:
106107
"""Kill all spawned processes.
@@ -396,7 +397,7 @@ def init_job_order(
396397
k: v for k, v in cmd_line.items() if k.startswith(record_name)
397398
}
398399
for key, value in record_items.items():
399-
record[key[len(record_name) + 1 :]] = value
400+
record[key[len(record_name) + 1:]] = value
400401
del cmd_line[key]
401402
cmd_line[str(record_name)] = record
402403
if "job_order" in cmd_line and cmd_line["job_order"]:
@@ -854,7 +855,9 @@ def main(
854855
addl = [] # type: List[str]
855856
if "CWLTOOL_OPTIONS" in os.environ:
856857
addl = os.environ["CWLTOOL_OPTIONS"].split(" ")
857-
args = arg_parser().parse_args(addl + argsl)
858+
parser = arg_parser()
859+
argcomplete.autocomplete(parser)
860+
args = parser.parse_args(addl + argsl)
858861
if args.record_container_id:
859862
if not args.cidfile_dir:
860863
args.cidfile_dir = os.getcwd()
@@ -895,7 +898,7 @@ def main(
895898
args.workflow = "CWLFile"
896899
else:
897900
_logger.error("CWL document required, no input file was provided")
898-
arg_parser().print_help()
901+
parser.print_help()
899902
return 1
900903
if args.relax_path_checks:
901904
command_line_tool.ACCEPTLIST_RE = command_line_tool.ACCEPTLIST_EN_RELAXED_RE

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
"typing-extensions",
106106
"coloredlogs",
107107
"pydot >= 1.4.1",
108+
"argcomplete",
108109
],
109110
extras_require={
110111
"deps": ["galaxy-tool-util"],

0 commit comments

Comments
 (0)