File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
src/codegen/cli/commands/run Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1313@click .command (name = "run" )
1414@requires_init
1515@click .argument ("label" , required = True )
16+ @click .option ("--path" , type = str , help = "Path to build the codebase from. Defaults to the repo root." )
1617@click .option ("--web" , is_flag = True , help = "Run the function on the web service instead of locally" )
1718@click .option ("--diff-preview" , type = int , help = "Show a preview of the first N lines of the diff" )
1819@click .option ("--arguments" , type = str , help = "Arguments as a json string to pass as the function's 'arguments' parameter" )
1920def run_command (
2021 session : CodegenSession ,
2122 label : str ,
23+ path : str | None = None ,
2224 web : bool = False ,
2325 diff_preview : int | None = None ,
2426 arguments : str | None = None ,
@@ -57,4 +59,4 @@ def run_command(
5759 else :
5860 from codegen .cli .commands .run .run_local import run_local
5961
60- run_local (session , codemod , diff_preview = diff_preview )
62+ run_local (session , codemod , diff_preview = diff_preview , path = path )
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ def run_local(
2626 session : CodegenSession ,
2727 function : DecoratedFunction ,
2828 diff_preview : int | None = None ,
29+ path : Path | None = None ,
2930) -> None :
3031 """Run a function locally against the codebase.
3132
@@ -35,10 +36,10 @@ def run_local(
3536 diff_preview: Number of lines of diff to preview (None for all)
3637 """
3738 # Parse codebase and run
38- repo_root = session .repo_path
39+ codebase_path = f" { session . repo_path } / { path } " if path else session .repo_path
3940
40- with Status (f"[bold]Parsing codebase at { repo_root } ..." , spinner = "dots" ) as status :
41- codebase = parse_codebase (repo_root )
41+ with Status (f"[bold]Parsing codebase at { codebase_path } ..." , spinner = "dots" ) as status :
42+ codebase = parse_codebase (codebase_path )
4243 status .update ("[bold green]✓ Parsed codebase" )
4344
4445 status .update ("[bold]Running codemod..." )
You can’t perform that action at this time.
0 commit comments