mypy/project,util
This commit is contained in:
parent
86d3615928
commit
eda963ba49
2 changed files with 9 additions and 7 deletions
|
@ -41,7 +41,7 @@ class Project:
|
|||
# root
|
||||
for variable in ROOT:
|
||||
if value := projects.environment.get(variable, None):
|
||||
self.root = value
|
||||
self.root = Path(value)
|
||||
# url
|
||||
self.url = add_url_path(projects.url, self.name)
|
||||
|
||||
|
|
14
spcd/util.py
14
spcd/util.py
|
@ -16,7 +16,7 @@ def add_url_path(url: str, extra_path: str) -> str:
|
|||
return urlunparse(parts)
|
||||
|
||||
|
||||
def browse(root: str) -> None:
|
||||
def browse(root: Path) -> None:
|
||||
"""Frame the browsing of a root directory in the log output."""
|
||||
paths = []
|
||||
for directory, _, files in os.walk(root):
|
||||
|
@ -24,17 +24,19 @@ def browse(root: str) -> None:
|
|||
absolute_path = Path(directory) / file
|
||||
relative_path = os.path.relpath(absolute_path, start=root)
|
||||
paths.append(relative_path)
|
||||
frame(root)
|
||||
text = str(root)
|
||||
frame(text)
|
||||
for path in sorted(paths):
|
||||
log.info(path)
|
||||
shut(root)
|
||||
shut(text)
|
||||
|
||||
|
||||
def cat(file: str) -> None:
|
||||
def cat(file: Path) -> None:
|
||||
"""Frame the content of a file in the log output."""
|
||||
frame(file)
|
||||
text = str(file)
|
||||
frame(text)
|
||||
log.info(fs.read_file_text(file).rstrip())
|
||||
shut(file)
|
||||
shut(text)
|
||||
|
||||
|
||||
def frame(text: str) -> None:
|
||||
|
|
Loading…
Reference in a new issue