-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdescribe_all.py
52 lines (44 loc) · 1.33 KB
/
describe_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import logging
from os import listdir
from genericpath import isdir
logging.getLogger().setLevel(logging.WARN)
def verify_item_in_project(item, local=None):
if item not in projects:
logging.info("not in projects")
if local:
here = f"{local}\\{item}"
else:
here = f"{item}"
list_dir(here, item)
def verify_itens_in_dir(dir, local):
for item in dir:
logging.info(f"item: {item}")
if isdir(item):
logging.info("not file")
if local:
here = f"{local}\\{item}"
else:
here = f"{item}"
list_dir(local=here)
verify_item_in_project(item, local)
continue
def list_dir(local = None, item = None):
if not str(local).split("\\")[-1].startswith("."):
logging.info(f"local: {local}, item: {item}")
dir = listdir(local)
logging.info(f"dir: {dir}")
if item and (".git" in dir):
logging.info("have git")
projects.append(item)
return
verify_itens_in_dir(dir, local)
logging.info("segunda")
try:
projects = [line.strip() for line in open('.config', 'r')]
except:
projects = []
list_dir()
logging.warning(projects)
with open('.config', 'w') as f:
for project in projects:
f.write(project + "\n")