1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-08 04:43:46 +01:00

Allow both files and directories to be passed to update-all (#10575)

Co-authored-by: J. Nick Koston <nick@home-assistant.io>
This commit is contained in:
Jonathan Swoboda
2025-09-09 19:06:59 -04:00
committed by GitHub
parent 422d209786
commit e218f16f0f
2 changed files with 152 additions and 6 deletions

View File

@@ -272,12 +272,15 @@ class OrderedDict(collections.OrderedDict):
return dict(self).__repr__()
def list_yaml_files(folders: list[str]) -> list[str]:
files = filter_yaml_files(
[os.path.join(folder, p) for folder in folders for p in os.listdir(folder)]
)
files.sort()
return files
def list_yaml_files(configs: list[str]) -> list[str]:
files: list[str] = []
for config in configs:
if os.path.isfile(config):
files.append(config)
else:
files.extend(os.path.join(config, p) for p in os.listdir(config))
files = filter_yaml_files(files)
return sorted(files)
def filter_yaml_files(files: list[str]) -> list[str]: