Move group loop into build_generated() for consistency
Now, all action functions are called with a group list as argument.
This commit is contained in:
parent
94ca9cc358
commit
378e13b988
@ -47,17 +47,18 @@ def collect_filenames(description, groupkey, ext_list):
|
|||||||
return sorted([filename for pattern in patterns for filename in path.glob(pattern)])
|
return sorted([filename for pattern in patterns for filename in path.glob(pattern)])
|
||||||
|
|
||||||
|
|
||||||
def build_generated(groupkey):
|
def build_generated(groupkeys):
|
||||||
# build files
|
for key in groupkeys:
|
||||||
path = groups[groupkey]['path']
|
# preparation
|
||||||
build_readme = readme in groups[groupkey]
|
path = groups[key]['path']
|
||||||
|
build_readme = readme in groups[key]
|
||||||
if build_readme:
|
if build_readme:
|
||||||
include_readme = 'md' in groups[groupkey][readme]
|
include_readme = 'md' in groups[key][readme]
|
||||||
include_source = 'yml' in groups[groupkey][readme]
|
include_source = 'yml' in groups[key][readme]
|
||||||
with open_file_write(path / readme) as out:
|
with open_file_write(path / readme) as out:
|
||||||
out.write(f'# {groups[groupkey]["title"]}\n\n')
|
out.write(f'# {groups[key]["title"]}\n\n')
|
||||||
# collect and iterate input YAML files
|
# collect and iterate input YAML files
|
||||||
for yaml_file in collect_filenames('Building', groupkey, input_extensions):
|
for yaml_file in collect_filenames('Building', key, input_extensions):
|
||||||
print(f' {yaml_file}')
|
print(f' {yaml_file}')
|
||||||
wireviz.parse_file(yaml_file)
|
wireviz.parse_file(yaml_file)
|
||||||
|
|
||||||
@ -133,9 +134,7 @@ def parse_args():
|
|||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
if args.action == 'build':
|
if args.action == 'build':
|
||||||
# TODO: Move this loop into the function for consistency?
|
build_generated(args.groups)
|
||||||
for groupkey in args.groups:
|
|
||||||
build_generated(groupkey)
|
|
||||||
elif args.action == 'clean':
|
elif args.action == 'clean':
|
||||||
clean_generated(args.groups)
|
clean_generated(args.groups)
|
||||||
elif args.action == 'compare':
|
elif args.action == 'compare':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user