Skip to content

Commit

Permalink
List codemods from all codemodders
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Nov 30, 2023
1 parent e348049 commit 6f38def
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/pixee/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,18 @@ def fix(path, dry_run):
def codemods():
"""List available codemods"""
console.print("Available codemods:", style="bold")
result = subprocess.run(
[PYTHON_CODEMODDER, "--list"], stdout=subprocess.PIPE, check=True
)
console.print(result.stdout.decode("utf-8").splitlines())

codemods = []
for codemodder in [PYTHON_CODEMODDER, JAVA_CODEMODDER]:
result = subprocess.run(
[codemodder, "--list"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
check=True,
)
codemods.extend(result.stdout.decode("utf-8").splitlines())
# TODO: filter out non-pixee codemods?
console.print(sorted(codemods))


if __name__ == "__main__":
Expand Down

0 comments on commit 6f38def

Please sign in to comment.