Skip to content

Commit

Permalink
feat: make it possible to render everything
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Aug 6, 2023
1 parent 145256f commit f5d3750
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions beet/contrib/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
]


from typing import Dict
from typing import Dict, Union

from beet import Context, ListOption, PluginOptions, configurable
from beet.core.utils import snake_case


class RenderOptions(PluginOptions):
resource_pack: Dict[str, ListOption[str]] = {}
data_pack: Dict[str, ListOption[str]] = {}
resource_pack: Union[Dict[str, ListOption[str]], ListOption[str]] = {}
data_pack: Union[Dict[str, ListOption[str]], ListOption[str]] = {}


def beet_default(ctx: Context):
Expand All @@ -31,8 +31,11 @@ def render(ctx: Context, opts: RenderOptions):
snake_case(file_type.__name__): file_type for file_type in file_types
}

for singular in list(group_map):
group_map.setdefault(f"{singular}s", group_map[singular])
if isinstance(groups, ListOption):
groups = {k: groups for k in group_map}
else:
for singular in list(group_map):
group_map.setdefault(f"{singular}s", group_map[singular])

for group, render_options in groups.items():
try:
Expand Down

0 comments on commit f5d3750

Please sign in to comment.