dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.63k stars 278 forks source link

command.after seems to do nothing #362

Open sugardave opened 3 months ago

sugardave commented 3 months ago

I'm working on expanding the DefinitelyTyped Vorpal definitions for my project where I want to use modes and I hate squiggly lines in my IDE. And as part of that project, I've found that I want to remove a command from a mode that is already initialized but should now not be available conditionally based on another command in that mode.

From this:

mode ->
    commandA
    commandB

Running commandB --some-option should result in this:

mode ->
    commandB

Looking through the source I see there is command.after which I figured would be a fine place to do a find/remove shuffle. But, it seems that nothing happens when the command finishes. However, command.done is also available and that seems to fire and I am able to remove commandA.

I wonder if command.after is supposed to work or not to determine if I should bother adding it to the Vorpal types in DefinitelyTyped.