Add module identity and outcome primitives
This commit is contained in:
37
identity.go
Normal file
37
identity.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package commandkit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
)
|
||||
|
||||
// Identity describes the application or component represented by CommandKit.
|
||||
//
|
||||
// Version and Revision are caller supplied metadata. CommandKit does not infer
|
||||
// them from an executable or mutate them.
|
||||
type Identity struct {
|
||||
// Name is the human-readable application or component name.
|
||||
Name string
|
||||
// Version is the caller-supplied version string.
|
||||
Version string
|
||||
// Revision is the caller-supplied source revision.
|
||||
Revision string
|
||||
}
|
||||
|
||||
// Streams contains the output destinations associated with a command
|
||||
// invocation.
|
||||
type Streams struct {
|
||||
// Out receives help and command reports.
|
||||
Out io.Writer
|
||||
// Err receives diagnostics and usage guidance.
|
||||
Err io.Writer
|
||||
}
|
||||
|
||||
// Invocation provides execution context and output streams to a command
|
||||
// handler.
|
||||
type Invocation struct {
|
||||
// Context carries caller cancellation and request-scoped values.
|
||||
Context context.Context
|
||||
// Streams are the caller-selected output destinations.
|
||||
Streams Streams
|
||||
}
|
||||
Reference in New Issue
Block a user