Skip to content

Commit a077414

Browse files
thatchamyreese
authored andcommitted
Add --keep, dep on newer twine
1 parent 158c2e4 commit a077414

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

squatter/__main__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ def cli() -> None: # pragma: no cover
1212

1313

1414
@cli.command(help="Generate a package")
15+
@click.option(
16+
"--keep", is_flag=True, default=False, help="Do not delete temp dir"
17+
)
1518
@click.option(
1619
"--upload", is_flag=True, default=False, help="Whether to invoke twine upload"
1720
)
@@ -21,11 +24,13 @@ def cli() -> None: # pragma: no cover
2124
)
2225
@click.argument("package_name")
2326
def generate(
24-
package_name: str, upload: bool, author: Optional[str], author_email: Optional[str]
27+
package_name: str, upload: bool, keep: bool, author: Optional[str], author_email: Optional[str]
2528
) -> None:
2629
# TODO flag for delete
27-
with tempfile.TemporaryDirectory(prefix=package_name) as d:
30+
with tempfile.TemporaryDirectory(prefix=package_name, delete=not keep) as d:
2831
env = Env(d)
32+
if keep:
33+
print("Generating in", d)
2934
env.generate(
3035
package_name=package_name, author=author, author_email=author_email
3136
)

0 commit comments

Comments
 (0)