get cmd: delete archive by default, add option to keep files
This commit is contained in:
parent
1af23910d7
commit
d44213731a
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "pycage"
|
name = "pycage"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
description = "tool to handle standalone Python installations from the CLI"
|
description = "tool to handle standalone Python installations from the CLI"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
||||||
@ -78,7 +78,7 @@ directory = "reports/coverage"
|
|||||||
|
|
||||||
|
|
||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.2.4"
|
current_version = "0.2.5"
|
||||||
parse = """(?x)
|
parse = """(?x)
|
||||||
(?P<major>0|[1-9]\\d*)\\.
|
(?P<major>0|[1-9]\\d*)\\.
|
||||||
(?P<minor>0|[1-9]\\d*)\\.
|
(?P<minor>0|[1-9]\\d*)\\.
|
||||||
|
|||||||
@ -113,6 +113,14 @@ def extract_archive(
|
|||||||
default=None,
|
default=None,
|
||||||
help="specifiy a different target location, default: current working directory",
|
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(
|
@click.option(
|
||||||
"-f",
|
"-f",
|
||||||
"--force-reextract",
|
"--force-reextract",
|
||||||
@ -133,6 +141,7 @@ def get(
|
|||||||
release_tag: str | None,
|
release_tag: str | None,
|
||||||
force_reextract: bool,
|
force_reextract: bool,
|
||||||
dl_folder: Path | None,
|
dl_folder: Path | None,
|
||||||
|
keep: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
url_metadata = cast(str, config.CFG["metadata"]["URL"])
|
url_metadata = cast(str, config.CFG["metadata"]["URL"])
|
||||||
os_file_info = config.CFG.os_info
|
os_file_info = config.CFG.os_info
|
||||||
@ -179,3 +188,12 @@ def get(
|
|||||||
)
|
)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print_error(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