feat(command): Add BareGroupAction support - #76
Conversation
Closures do not implement the Debug Trait, so It'll fail to compile If left as is.
46cbf8a to
0dc5201
Compare
|
I'm not so sure about this. Do you have a concrete example of how you would use this feature? It looks like you plan on doing something custom for specific groups, but I wonder if what we really are looking for is something more general for groups. @wcole1-godaddy do you recall the specific feedback that caused the line in DEVEX-717 that says:
I assume that's why this is being created, @mguerrero3-godaddy? I also wonder if |
Yes that's exactly why. Unsure If this intended changes only on cli side but this is for being able to define an action for the parent group instead of falling to the help text, added to the actual engine so cli just would need to define the action. e.g. When you mean more general is like pre-defined instead of customizable ? |
|
Well what specifically would the group action we'd be adding to Sorry for the vagueness of these tickets; they were created in reference to @wcole1-godaddy's feedback, but the intent was for us to first plan out the feature rather than jumping right into exactly duplicating the TS CLI's functionality in all cases. Let's make sure the same capabilities exist even if they don't work exactly the same way. If we have a capability gap, let's add it universally if it's a cross-cutting concern. |
No problem! Good point on gddy tree --json, seems like I missed that entirely. Rethinking this with your thoughts... instead of a per-group opt-in closure, change the default bare-group fallback from clap's plain-text help to the same JSON tree node tree already builds Sound right, @jpage-godaddy? If so I'll rework the PR that way. |
I like the idea, but one of the design deviations with the original |
|
Reimplemented on #78 (Also to rename branch following proper guidelines) |
Summary
Adds support for bare group actions, groups can now register a callback that runs when invoked with no subcommand, rendering its return value as the JSON envelope instead of default group help text. This as part of the AC on DEVEX-717
Test plan
cargo fmt --all --checkcargo clippy --all-targets -- -D warningscargo test --all-targetsManual verification
Setup:
Test WITHOUT the fix (baseline):
Test WITH the fix:
Cleanup: