Document and validate automatic usage reporting

This commit is contained in:
2026-11-22 21:06:39 +00:00
parent a0608a53ee
commit a0cdd3d7c5
13 changed files with 188 additions and 30 deletions

View File

@@ -15,6 +15,13 @@ type InvocationFeature struct{ record *invocationFeatureRecord }
// NewInput creates fresh input for each invocation; nil uses the zero value.
// Start receives the current invocation and may return a replacement context
// and a function producing a report at invocation finalization. Start is required.
// Features start in installation traversal order after command input construction
// and successful CheckInput; each receives the context returned by its predecessor.
// A nil context leaves it unchanged and a nil report function produces no report.
// Report functions run once after deferred messages and before terminal explanations,
// even after a returned failure or cancellation. Reports render as text on
// diagnostics, with quiet suppressing delivery. Generated help, version and
// completion, and preflight failures do not start features.
type InvocationFeatureSpec[I any] struct {
NewInput func() I
Flags []Flag[I]