Skip to content

Commit

Permalink
Support passing arguments to scripts (fixes #18) (#21)
Browse files Browse the repository at this point in the history
This turned out to be an easier PR than I expected. run_handler/run_path already use sys.argv directly; I just added a catchall argument to the argparser so it doesn't complain about additional tokens.

Doesn't look like there are tests for this in test_cli.py, but let me know if I should create a new one.
  • Loading branch information
folz authored and carljm committed Dec 16, 2017
1 parent bcae27a commit e87adb3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions monkeytype/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ def main(argv: List[str], stdout: IO, stderr: IO) -> int:
'script_path',
type=str,
help="""Filesystem path to a Python script file to run under tracing""")
run_parser.add_argument(
'script_args',
nargs=argparse.REMAINDER,
)
run_parser.set_defaults(handler=run_handler)

apply_parser = subparsers.add_parser(
Expand Down

0 comments on commit e87adb3

Please sign in to comment.