gitignore_clean.py: FIXME: fix directory conflicts
This commit is contained in:
parent
bcbdbf22e2
commit
50a83f3c0e
|
@ -3,7 +3,7 @@
|
|||
from glob import glob
|
||||
from os import remove as os_remove
|
||||
from os.path import isdir as path_isdir, isfile as path_isfile, abspath, \
|
||||
basename
|
||||
basename, dirname
|
||||
from pathlib import Path
|
||||
from re import sub as re_sub
|
||||
from shutil import rmtree
|
||||
|
@ -58,9 +58,12 @@ def extend_wildcards(patterns: list) -> list:
|
|||
|
||||
|
||||
def clean_gitignored_files(base_path: str = ".") -> None:
|
||||
# FIXME: doesn't work as intended
|
||||
for gitignore_path in list(Path(base_path).rglob("*.gitignore")):
|
||||
directory = dirname(gitignore_path)
|
||||
for file_path in extend_wildcards(read_gitignore(gitignore_path)):
|
||||
delete(file_path)
|
||||
full_path = directory + "/" + file_path
|
||||
delete(full_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue