Skip to content

Commit

Permalink
Fix #528 by focusing on subcollections' bound names instead of intrin…
Browse files Browse the repository at this point in the history
…sic names

Also happens to end up simplifying the overall recursion loop too.
  • Loading branch information
bitprophet committed Jun 21, 2018
1 parent c55b88f commit 3a12557
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions invoke/program.py
Expand Up @@ -678,13 +678,7 @@ def _make_pairs(self, coll, ancestors=None):
ancestors = []
pairs = []
indent = len(ancestors) * self.indent
# NOTE: skip 1st ancestor as it's always the root & thus
# implicit/unnamed; and also remember to loop in current coll
# (again unless it's itself the root)
display_ancestors = ancestors[1:]
if ancestors:
display_ancestors.append(coll)
ancestor_path = '.'.join(x.name for x in display_ancestors)
ancestor_path = '.'.join(x for x in ancestors)
for name, task in sorted(six.iteritems(coll.tasks)):
is_default = name == coll.default
# Start with just the name and just the aliases, no prefixes or
Expand Down Expand Up @@ -738,7 +732,7 @@ def _make_pairs(self, coll, ancestors=None):
pairs.append((ancestor_path + displayname, helpline(subcoll)))
# Recurse, if not already at max depth
if not truncate:
recursed_pairs = self._make_pairs(subcoll, ancestors + [coll])
recursed_pairs = self._make_pairs(coll=subcoll, ancestors=ancestors + [name])
pairs.extend(recursed_pairs)
return pairs

Expand Down

0 comments on commit 3a12557

Please sign in to comment.