params[var] = i
r.extend(expand_list(params, c["command"]))
return r
- if "list" in c and "index" in c:
+ if "list" in c and "index" in c and "command" in c:
var = c["list"]
items = get_items(p, p[var])
- return items[int(c["index"])]
+ params = copy.copy(p)
+ params[var] = items[int(c["index"])]
+ return expand_list(params, c["command"])
elif isinstance(c, list):
return expand_list(p, c)
elif isinstance(c, str) or isinstance(c, unicode):
return []
def expand_list(p, l):
- return [exp for arg in l for exp in expand_item(p, arg)]
+ if isinstance(l, basestring):
+ return [expand_item(p, l)]
+ else:
+ return [exp for arg in l for exp in expand_item(p, arg)]
def add_to_group(gr, match):
m = ('^_^').join(match.groups())