Skip to content

Commit bc7398c

Browse files
committed
fix AssertionError on valid choices
- fixes #14
1 parent 2a4b038 commit bc7398c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shtab/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ def recurse(parser, prefix):
204204
),
205205
file=fd,
206206
)
207-
else:
208-
assert isinstance(sub.choices, dict)
207+
elif isinstance(sub.choices, dict):
209208
log.debug("subcommand:%s", cmd)
210209
if sub.choices[cmd].add_help:
211210
commands.append(cmd)
@@ -215,6 +214,8 @@ def recurse(parser, prefix):
215214
)
216215
else:
217216
log.debug("skip:subcommand:%s", cmd)
217+
else:
218+
commands.append(cmd)
218219
else:
219220
log.debug("uncompletable:{}:{}".format(prefix, sub.dest))
220221

0 commit comments

Comments
 (0)