Skip to content

Commit

Permalink
Add container range syntax (#13)
Browse files Browse the repository at this point in the history
* Add container range syntax

* allow mixing container id modes

Co-authored-by: jurialmunkey <[email protected]>
  • Loading branch information
roidy and jurialmunkey committed Jul 10, 2022
1 parent b22ee67 commit bb7e662
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion resources/lib/skinvariables.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def build_json(self, file):
continue # No values or expression so skip

item['name'] = variable.attrib.get('name')
item['containers'] = [try_int(i) for i in variable.attrib.get('containers', '').split(',') if i]
item['containers'] = [
j for i in variable.attrib.get('containers', '').split(',') for j
in (range(*(int(y) + x for x, y, in enumerate(i.split('...')))) if '...' in i else (int(i),))]
item['listitems'] = {}
item['listitems']['start'] = try_int(variable.attrib.get('start'))
item['listitems']['end'] = try_int(variable.attrib.get('end'))
Expand Down

0 comments on commit bb7e662

Please sign in to comment.