summaryrefslogtreecommitdiff
path: root/src/pyssg/discovery.py
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-05-09 12:37:01 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2021-05-09 12:37:01 -0600
commit0a9c6693255800c6c197a3dcf3614046c296e293 (patch)
treed4e9999c2a0931db95379f7cb3a9c5fe0d7a7eaa /src/pyssg/discovery.py
parent6f143604c28c3165db35c2cad99a0dc76d7ccdaa (diff)
semiworking program, still very alpha
Diffstat (limited to 'src/pyssg/discovery.py')
-rw-r--r--src/pyssg/discovery.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pyssg/discovery.py b/src/pyssg/discovery.py
index 39c8bb1..606c1d0 100644
--- a/src/pyssg/discovery.py
+++ b/src/pyssg/discovery.py
@@ -11,7 +11,7 @@ def get_file_list(extensions: list[str], exclude: list[str]=None) -> list[str]:
for f in files:
if f.endswith(tuple(extensions)):
- out.append(os.path.join(root, f))
+ out.append(os.path.join(root, f).replace(cwd, '')[1:])
return out
@@ -27,14 +27,19 @@ def get_dir_structure(exclude: list[str]=None) -> list[str]:
for d in dirs:
if root in out:
out.remove(root)
- out.append(os.path.join(root, d).replace(cwd, ''))
+ out.append(os.path.join(root, d))
+
+ return [o.replace(cwd, '')[1:] for o in out]
- return out
+def get_all_files(src: str) -> tuple[list[str], list[str], list[str]]:
+ iwd = os.getcwd()
+ os.chdir(src)
-def get_all_files():
md_files = get_file_list(['.md', '.markdown'], ['templates'])
html_files = get_file_list(['.html'], ['templates'])
dirs = get_dir_structure(['templates'])
+ os.chdir(iwd)
+
return (dirs, md_files, html_files)