Documentation ¶
Index ¶
- func LoggerFromContext(ctx context.Context) *slog.Logger
- func LoggerIntoContext(ctx context.Context, logger *slog.Logger) context.Context
- func ToolIntoContext(ctx context.Context, tool *Tool) context.Context
- type Tool
- type ToolBuilder
- func (b *ToolBuilder) AddArg(value string) *ToolBuilder
- func (b *ToolBuilder) AddArgs(values ...string) *ToolBuilder
- func (b *ToolBuilder) AddCommand(value func() *cobra.Command) *ToolBuilder
- func (b *ToolBuilder) AddCommands(values ...func() *cobra.Command) *ToolBuilder
- func (b *ToolBuilder) Build() (result *Tool, err error)
- func (b *ToolBuilder) SetArgs(values ...string) *ToolBuilder
- func (b *ToolBuilder) SetErr(value io.Writer) *ToolBuilder
- func (b *ToolBuilder) SetIn(value io.Reader) *ToolBuilder
- func (b *ToolBuilder) SetLogger(value *slog.Logger) *ToolBuilder
- func (b *ToolBuilder) SetOut(value io.Writer) *ToolBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoggerFromContext ¶
LoggerFromContext returns the logger from the context. It panics if the given context doesn't contain a logger.
func LoggerIntoContext ¶
LoggerIntoContext creates a new context that contains the given logger.
Types ¶
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool is an instance of the command line tool. Don't create instances of this directly, use the NewTool function instead.
func ToolFromContext ¶
ToolFromContext returns the tool from the context. It panics if the given context doesn't contain the tool.
type ToolBuilder ¶
type ToolBuilder struct {
// contains filtered or unexported fields
}
ToolBuilder contains the data and logic needed to create an instance of the command line tool. Don't create instances of this directly, use the NewTool function instead.
func NewTool ¶
func NewTool() *ToolBuilder
NewTool creates a builder that can then be used to configure and create an instance of the command line tool.
func (*ToolBuilder) AddArg ¶
func (b *ToolBuilder) AddArg(value string) *ToolBuilder
AddArg adds one command line argument.
func (*ToolBuilder) AddArgs ¶
func (b *ToolBuilder) AddArgs(values ...string) *ToolBuilder
AddArgs adds a list of command line arguments.
func (*ToolBuilder) AddCommand ¶
func (b *ToolBuilder) AddCommand(value func() *cobra.Command) *ToolBuilder
AddCommand adds a sub-command.
func (*ToolBuilder) AddCommands ¶
func (b *ToolBuilder) AddCommands(values ...func() *cobra.Command) *ToolBuilder
AddCommands adds a list of sub-commands.
func (*ToolBuilder) Build ¶
func (b *ToolBuilder) Build() (result *Tool, err error)
Build uses the data stored in the buider to create a new instance of the command line tool.
func (*ToolBuilder) SetArgs ¶
func (b *ToolBuilder) SetArgs(values ...string) *ToolBuilder
SetArgs sets the list of command line arguments.
func (*ToolBuilder) SetErr ¶
func (b *ToolBuilder) SetErr(value io.Writer) *ToolBuilder
SetErr sets the standard error output stream. This is mandatory.
func (*ToolBuilder) SetIn ¶
func (b *ToolBuilder) SetIn(value io.Reader) *ToolBuilder
SetIn sets the standard input stream. This is mandatory.
func (*ToolBuilder) SetLogger ¶
func (b *ToolBuilder) SetLogger(value *slog.Logger) *ToolBuilder
SetLogger sets the logger that the tool will use to write messages to the log. This is optional, and if not specified a new one will be created that writes JSON messages to a file `o2ims.log` file inside the tool cache directory.
func (*ToolBuilder) SetOut ¶
func (b *ToolBuilder) SetOut(value io.Writer) *ToolBuilder
SetOut sets the standard output stream. This is mandatory.
Directories ¶
Path | Synopsis |
---|---|
Code generated by MockGen.
|
Code generated by MockGen. |
alarms/api/generated
Package generated provides primitives to interact with the openapi HTTP API.
|
Package generated provides primitives to interact with the openapi HTTP API. |
alarms/internal/resourceserver/generated
Package generated provides primitives to interact with the openapi HTTP API.
|
Package generated provides primitives to interact with the openapi HTTP API. |
common/api/generated
Package generated provides primitives to interact with the openapi HTTP API.
|
Package generated provides primitives to interact with the openapi HTTP API. |
resources/api/generated
Package generated provides primitives to interact with the openapi HTTP API.
|
Package generated provides primitives to interact with the openapi HTTP API. |