Fix list subcommand to work from any working directory.
This commit is contained in:
@@ -119,30 +119,35 @@ def convert(args):
|
|||||||
|
|
||||||
|
|
||||||
def list_configs():
|
def list_configs():
|
||||||
|
excluded_files = ["schema.yaml"]
|
||||||
|
excluded_dirs = ["__pycache__"]
|
||||||
cprint("Available import/export formats:", "cyan", attrs=["bold"])
|
cprint("Available import/export formats:", "cyan", attrs=["bold"])
|
||||||
printed_dirs = []
|
printed_dirs = []
|
||||||
for folder in AuDaGe.folders:
|
for folder in AuDaGe.folders:
|
||||||
cprint(" Folder '" + folder.name + "':", "green", attrs=["bold"])
|
cprint(" Folder '" + folder.name + "':", "green", attrs=["bold"])
|
||||||
for dirpath, _, files in folder.walk(on_error=print):
|
for dirpath, _, files in folder.walk(on_error=print):
|
||||||
dir_path = Path(dirpath)
|
dir_path = Path(dirpath).relative_to(folder)
|
||||||
if (
|
if (
|
||||||
len(dir_path.parts) >= 2
|
len(dir_path.parts) >= 1
|
||||||
and dir_path.parts[1] not in printed_dirs
|
and dir_path.parts[0] not in excluded_dirs + printed_dirs
|
||||||
):
|
):
|
||||||
printed_dirs.append(dir_path.parts[1])
|
printed_dirs.append(dir_path.parts[0])
|
||||||
cprint(
|
cprint(
|
||||||
" " + dir_path.parts[1].replace("_", " ").title() + ":",
|
" " + dir_path.parts[0].replace("_", " ").title() + ":",
|
||||||
attrs=["bold"],
|
attrs=["bold"],
|
||||||
)
|
)
|
||||||
for file in files:
|
for file in files:
|
||||||
file_path = Path(file)
|
file_path = Path(file)
|
||||||
if file_path.suffix == ".yaml":
|
if (
|
||||||
|
file_path.suffix == ".yaml"
|
||||||
|
and file not in excluded_files
|
||||||
|
):
|
||||||
print(
|
print(
|
||||||
" "
|
" "
|
||||||
+ str(
|
+ str(
|
||||||
Path(*Path(dirpath).parts[1:]).joinpath(
|
Path(
|
||||||
file_path.stem
|
*Path(dirpath).relative_to(folder).parts[1:]
|
||||||
)
|
).joinpath(file_path.stem)
|
||||||
).replace("\\", ".")
|
).replace("\\", ".")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user