Closed khill-fbmc closed 2 weeks ago
Nested command can be added like this:
program()
.add(
command("session")
.add(
command("start")
.action(() => console.log("start"))
)
.add(
command("stop")
.action(() => console.log("stop"))
)
// and so on...
)
.run();
Hope this helps.
If you have any ideas how to improve this for your use case, I'm curious to hear!
First off, love this library, primarily for the REPL features. I keep eyeing Clipanion since it seems like it is designed to be used as a multi-command, nested type of program. I like that, but then I loose my nice REPL features you've added.
This is what I have setup so far, (
match
is from ts-pattern)It works, but does not feel very scalable. Is there a better approach to make nested type commands?