chore(keyringctl): deduplicate iteration and split code in convert()
This commit is contained in:
parent
ac798eeeab
commit
6299f6416e
14
keyringctl
14
keyringctl
@ -753,19 +753,13 @@ def convert(
|
||||
"""
|
||||
|
||||
directories: List[Path] = []
|
||||
if source.is_dir():
|
||||
for key in source.iterdir():
|
||||
keys: Iterable[Path] = source.iterdir() if source.is_dir() else [source]
|
||||
|
||||
for key in keys:
|
||||
name = name_override or key.stem
|
||||
for cert in keyring_split(working_dir=working_dir, keyring=key):
|
||||
directories.append(
|
||||
convert_certificate(working_dir=working_dir, certificate=cert, name_override=name)
|
||||
)
|
||||
else:
|
||||
name = name_override or source.stem
|
||||
for cert in keyring_split(working_dir=working_dir, keyring=source):
|
||||
directories.append(
|
||||
convert_certificate(working_dir=working_dir, certificate=cert, name_override=name)
|
||||
)
|
||||
convert_certificate(working_dir=working_dir, certificate=cert, name_override=name))
|
||||
|
||||
for path in directories:
|
||||
(target_dir / path.name).mkdir(exist_ok=True)
|
||||
|
Loading…
Reference in New Issue
Block a user