Skip to content

Commit

Permalink
feat: support multiple target path arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
akx authored and browniebroke committed Oct 13, 2020
1 parent 60a1ae3 commit 8dafb0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions django_codemod/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def djcodemod():


@djcodemod.command()
@click.argument("path")
@click.argument("path", nargs=-1, required=True)
@click.option(
"--removed-in",
"removed_in",
Expand All @@ -115,7 +115,9 @@ def djcodemod():
help="The version of Django where deprecations started.",
type=VersionParamType(DEPRECATED_IN),
)
def run(removed_in: Tuple[int, int], deprecated_in: Tuple[int, int], path: str) -> None:
def run(
removed_in: Tuple[int, int], deprecated_in: Tuple[int, int], path: List[str]
) -> None:
"""
Automatically fixes deprecations removed Django deprecations.
Expand All @@ -134,9 +136,9 @@ def run(removed_in: Tuple[int, int], deprecated_in: Tuple[int, int], path: str)
call_command(command_instance, path)


def call_command(command_instance: BaseCodemodCommand, path: str):
def call_command(command_instance: BaseCodemodCommand, path: List[str]):
"""Call libCST with our customized command."""
files = gather_files([path])
files = gather_files(path)
try:
# Super simplified call
result = parallel_exec_transform_with_prettyprint(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_missing_argument(cli_runner):
result = cli_runner.invoke(cli.djcodemod, ["run"])

assert result.exit_code == 2
assert "Error: Missing argument 'PATH'" in result.output
assert "Error: Missing argument 'PATH" in result.output


@pytest.mark.parametrize(
Expand Down

0 comments on commit 8dafb0f

Please sign in to comment.