get cmd: delete archive by default, add option to keep files, closes #7
This commit is contained in:
parent
1af23910d7
commit
1addbeffda
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "pycage"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
description = "tool to handle standalone Python installations from the CLI"
|
||||
authors = [
|
||||
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
||||
@ -78,7 +78,7 @@ directory = "reports/coverage"
|
||||
|
||||
|
||||
[tool.bumpversion]
|
||||
current_version = "0.2.4"
|
||||
current_version = "0.2.5"
|
||||
parse = """(?x)
|
||||
(?P<major>0|[1-9]\\d*)\\.
|
||||
(?P<minor>0|[1-9]\\d*)\\.
|
||||
|
||||
@ -113,6 +113,14 @@ def extract_archive(
|
||||
default=None,
|
||||
help="specifiy a different target location, default: current working directory",
|
||||
)
|
||||
@click.option(
|
||||
"-k",
|
||||
"--keep",
|
||||
is_flag=True,
|
||||
show_default=True,
|
||||
default=False,
|
||||
help="keep the downloaded archive",
|
||||
)
|
||||
@click.option(
|
||||
"-f",
|
||||
"--force-reextract",
|
||||
@ -133,6 +141,7 @@ def get(
|
||||
release_tag: str | None,
|
||||
force_reextract: bool,
|
||||
dl_folder: Path | None,
|
||||
keep: bool,
|
||||
) -> None:
|
||||
url_metadata = cast(str, config.CFG["metadata"]["URL"])
|
||||
os_file_info = config.CFG.os_info
|
||||
@ -179,3 +188,12 @@ def get(
|
||||
)
|
||||
except Exception as err:
|
||||
print_error(err)
|
||||
|
||||
if not keep:
|
||||
try:
|
||||
src_file.unlink()
|
||||
except Exception as err:
|
||||
click.echo(
|
||||
"The archive file could not be deleted because of following exception..."
|
||||
)
|
||||
print_error(err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user