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 13
13
@click .command (name = "run" )
14
14
@requires_init
15
15
@click .argument ("label" , required = True )
16
+ @click .option ("--path" , type = str , help = "Path to build the codebase from. Defaults to the repo root." )
16
17
@click .option ("--web" , is_flag = True , help = "Run the function on the web service instead of locally" )
17
18
@click .option ("--diff-preview" , type = int , help = "Show a preview of the first N lines of the diff" )
18
19
@click .option ("--arguments" , type = str , help = "Arguments as a json string to pass as the function's 'arguments' parameter" )
19
20
def run_command (
20
21
session : CodegenSession ,
21
22
label : str ,
23
+ path : str | None = None ,
22
24
web : bool = False ,
23
25
diff_preview : int | None = None ,
24
26
arguments : str | None = None ,
@@ -57,4 +59,4 @@ def run_command(
57
59
else :
58
60
from codegen .cli .commands .run .run_local import run_local
59
61
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(
26
26
session : CodegenSession ,
27
27
function : DecoratedFunction ,
28
28
diff_preview : int | None = None ,
29
+ path : Path | None = None ,
29
30
) -> None :
30
31
"""Run a function locally against the codebase.
31
32
@@ -35,10 +36,10 @@ def run_local(
35
36
diff_preview: Number of lines of diff to preview (None for all)
36
37
"""
37
38
# Parse codebase and run
38
- repo_root = session .repo_path
39
+ codebase_path = f" { session . repo_path } / { path } " if path else session .repo_path
39
40
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 )
42
43
status .update ("[bold green]✓ Parsed codebase" )
43
44
44
45
status .update ("[bold]Running codemod..." )
You can’t perform that action at this time.
0 commit comments