Default Subcommand #4134
Replies: 3 comments 10 replies
-
If I've read your question correctly
Looking at the example, we were able to do it without any duplication and minimal boilerplate (a flattened field and an
You can specify actual global args in the parent command using the
Could you expand on what you see as inelegant about this solution? For what is capable of being done (sharing in a declarative API), this is probably the best that is ever going to exist. |
Beta Was this translation helpful? Give feedback.
-
For anyone else following along, we also have an issue |
Beta Was this translation helpful? Give feedback.
-
FYI #4350 was merged which should simplify some default subcommand cases (the flattened struct can have required fields now) |
Beta Was this translation helpful? Give feedback.
-
Hello, I want to implement the following behavior:
Using the tricks as in Default Subcommand #3566 we get two problems:
The first problem can obviously be solved, inelegantly, by defining a 'global'
Args
struct, which gets flattened into each subcommand – resulting in less duplication.Is there a method to circumvent all this without having proper default subcommands?
Beta Was this translation helpful? Give feedback.
All reactions