Example for Dynamic Cli Construction? #1415
-
Is there an example somewhere of how to dynamically populate a CommandApp with branches and commands? My issue is that I have several independent modules where each module would like to contribute branches and commands to the same command app. Some modules would also like to add branches and commands on to the same branch(es) as another module. Ideas? Thanks! P.S. Hopefully there's a solution, but it would be interesting to support this sort of use with a method like MountCommand(path, command) where path would be a series of branches separated by slashes. For example:
We did this in Apache Wicket, and it turned out to be a winner in that case. -- Jon |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@jonathanlocke This is not a scenario that we support OOTB (and probably won't either), but you should be able to create something using the We haven't documented this, but take a look at the tests over at https://github.com/spectreconsole/spectre.console/blob/main/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Unsafe.cs for more information. |
Beta Was this translation helpful? Give feedback.
@jonathanlocke This is not a scenario that we support OOTB (and probably won't either), but you should be able to create something using the
IUnsafeConfigurator
.We haven't documented this, but take a look at the tests over at https://github.com/spectreconsole/spectre.console/blob/main/test/Spectre.Console.Cli.Tests/Unit/CommandAppTests.Unsafe.cs for more information.