Skip to content

Commit

Permalink
allow multiple input
Browse files Browse the repository at this point in the history
  • Loading branch information
dorschw committed Dec 23, 2024
1 parent 564bac7 commit 8ab2872
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions demisto_sdk/scripts/sort_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,17 @@ def sort_file(path: Path) -> None:


def _main(
path: Annotated[
Path,
Argument(
help="The file to sort, or a directory containing files to sort.",
file_okay=True,
dir_okay=True,
exists=True,
readable=True,
writable=True,
),
paths: Annotated[
list[Path],
Argument(help="The file to sort, or a directory containing files to sort."),
],
) -> None:
if path.is_file():
sort_file(path)
else:
for file in set(path.glob("*.yml")).union(path.glob("*.yaml")):
sort_file(file)
for path in paths:
if path.is_file():
sort_file(path)
else:
for file in set(path.glob("*.yml")).union(path.glob("*.yaml")):
sort_file(file)


def main():
Expand Down

0 comments on commit 8ab2872

Please sign in to comment.