New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: context must be reset, or nested sub-commands fail on second invocation #678
Conversation
Hmm, the whole point of the generic I really need to test this thoroughly and would argue for a different solution. |
@nexdrew keep in mind that the only time we reset the context object is in-between distinct runs of
The nested command handlers do invoke |
Ok, resetting the "context" makes more sense in the |
@nexdrew did a bit of digging, this is the underlying issue here: if (visited) {
// check for cyclic reference
// each command file path should only be seen once per execution
if (~context.files.indexOf(joined)) return visited
// keep track of visited files in context.files
context.files.push(joined)
self.addHandler(visited)
} Because |
Ok, wow, good find. I didn't realize the problem is specific to a command that uses (Also, I apologize for my presumptive knee-jerk reaction! 😔 I should have taken more time to understand/diagnose the problem before responding. Thanks for keeping a level head and finding the root cause for us, which you have now had to fix twice! 😳) Let me do a bit of experimenting to see if I can make the |
so context is maintained for multiple command executions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I vote merge once we confirm the new test passes.
This addresses an issue @ceejbot ran into using headless
.parse()
in conjunction with nested sub-commands.CC: @nexdrew