Connect invocation execution to one reporter
This commit is contained in:
12
identity.go
12
identity.go
@@ -37,20 +37,22 @@ func normalizeStreams(streams Streams) Streams {
|
||||
return streams
|
||||
}
|
||||
|
||||
// Invocation provides execution context and output streams to a command
|
||||
// handler. For command aliases, EnteredPath and CanonicalPath expose the route
|
||||
// the caller used and the selected canonical command path. Both omit the
|
||||
// Invocation provides execution context and reporting to a command handler.
|
||||
// For command aliases, EnteredPath and CanonicalPath expose the route the
|
||||
// caller used and the selected canonical command path. Both omit the
|
||||
// executable name, flags, and operands.
|
||||
type Invocation struct {
|
||||
// Context carries caller cancellation and request-scoped values.
|
||||
Context context.Context
|
||||
// Streams are the caller-selected output destinations.
|
||||
Streams Streams
|
||||
|
||||
reporter *Reporter
|
||||
enteredPath string
|
||||
canonicalPath string
|
||||
}
|
||||
|
||||
// Reporter returns the reporting facility for this invocation.
|
||||
func (inv Invocation) Reporter() *Reporter { return inv.reporter }
|
||||
|
||||
// EnteredPath returns the command path used to invoke the selected command,
|
||||
// excluding the executable name, flags, and operands. It is empty for an
|
||||
// Invocation that was not created by command execution.
|
||||
|
||||
Reference in New Issue
Block a user