mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-24 19:20:44 -06:00
Compare commits
3 commits
ea50661a04
...
852ce927c0
Author | SHA1 | Date | |
---|---|---|---|
852ce927c0 | |||
28c268b8f0 | |||
247f80921d |
1 changed files with 11 additions and 7 deletions
|
@ -3427,21 +3427,24 @@ class Viv:
|
|||
cli: Path,
|
||||
yes: bool,
|
||||
) -> None:
|
||||
to_remove = []
|
||||
to_remove_dirs = []
|
||||
to_remove_files = []
|
||||
if Cfg().cache_base.is_dir():
|
||||
to_remove.append(Cfg().cache_base)
|
||||
to_remove_dirs.append(Cfg().cache_base)
|
||||
if src.is_file():
|
||||
to_remove.append(src.parent if src == (Cfg().src) else src)
|
||||
to_remove_files.append(src.parent if src == (Cfg().src) else src)
|
||||
if self.local_source and self.local_source.is_file():
|
||||
if self.local_source.parent.name == "viv":
|
||||
to_remove.append(self.local_source.parent)
|
||||
to_remove_files.append(self.local_source.parent)
|
||||
else:
|
||||
to_remove.append(self.local_source)
|
||||
to_remove_files.append(self.local_source)
|
||||
|
||||
if cli.is_file():
|
||||
to_remove.append(cli)
|
||||
to_remove_files.append(cli)
|
||||
|
||||
to_remove = list(set(to_remove))
|
||||
to_remove = sorted(
|
||||
set(to_remove_dirs + to_remove_files), key=lambda p: p.is_file()
|
||||
)
|
||||
if confirm(
|
||||
"Remove the above files/directories?",
|
||||
"\n".join(f" - {a.red}{p}{a.end}" for p in to_remove) + "\n",
|
||||
|
@ -3449,6 +3452,7 @@ class Viv:
|
|||
):
|
||||
for p in to_remove:
|
||||
if p.is_dir():
|
||||
print(sorted(p.glob("**/*")))
|
||||
shutil.rmtree(p)
|
||||
else:
|
||||
p.unlink()
|
||||
|
|
Loading…
Reference in a new issue