Skip to content

Commit 2ccb013

Browse files
authored
fix: bug where codemod file is not created for create with -d arg (#286)
# Motivation <!-- Why is this change necessary? --> # Content <!-- Please include a summary of the change --> # Testing <!-- How was the change tested? --> # Please check the following before marking your PR as ready for review - [ ] I have added tests for my changes - [ ] I have updated the documentation or added new documentation as needed
1 parent 3fcd4b7 commit 2ccb013

File tree

1 file changed

+5
-4
lines changed
  • src/codegen/cli/commands/create

1 file changed

+5
-4
lines changed

src/codegen/cli/commands/create/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def create_command(session: CodegenSession, name: str, path: Path, description:
8787

8888
rich.print("") # Add a newline before output
8989
response = None
90+
code = None
9091
try:
9192
if description:
9293
# Use API to generate implementation
@@ -99,11 +100,11 @@ def create_command(session: CodegenSession, name: str, path: Path, description:
99100
# Use default implementation
100101
code = DEFAULT_CODEMOD.format(name=name)
101102

102-
# Create the target directory if needed
103-
codemod_path.parent.mkdir(parents=True, exist_ok=True)
103+
# Create the target directory if needed
104+
codemod_path.parent.mkdir(parents=True, exist_ok=True)
104105

105-
# Write the function code
106-
codemod_path.write_text(code)
106+
# Write the function code
107+
codemod_path.write_text(code)
107108

108109
except (ServerError, ValueError) as e:
109110
raise click.ClickException(str(e))

0 commit comments

Comments
 (0)