Replies: 1 comment 5 replies
-
This is actually by design. The philosophy behind Spectre.Console.Cli is to separate the commands from the settings and tie everything together via composition. I suspect something else would be more suitable for your needs, such as the excellent System.CommandLine. I use it myself when my needs go beyond what Spectre.Console.Cli was designed for. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
The docs show how to create command:
And how to add it to the app in
Program.Main
:It's not ideal that the config is separate from the command.
Describe the solution you'd like
It would be nice to be able to define all config in one place, in the command. For example:
That would be good in 80% of the cases. But using attributes means we must use compile-time constants. So it would be nice to also have config in the constructor:
But there are more case (I've already had one) where you want to call a virtual method, but can't from a ctor, so it would be nice to have config in a virtual method or property:
Not all the above are necessary, I'm just highlighting the different issues. But it would be beneficial to have the flexibility to define the config where it makes sense for each person:
Describe alternatives you've considered
Using what is available right now. It's a little messy but it works 100%.
Additional context
Thank you for this incredible tool, it makes writing a console programme really easy.
Beta Was this translation helpful? Give feedback.
All reactions