Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeShutdownCh ¶
func MakeShutdownCh() chan struct{}
MakeShutdownCh returns a channel that can be used for shutdown notifications for commands. This channel will send a message for every SIGINT or SIGTERM received.
Types ¶
type Command ¶
type Command struct {
// Context is the base context for the command. It is up to commands to
// utilize this context so that cancellation works in a timely manner.
Context context.Context
// Flags is the flag set for the command.
Flags *flag.FlagSet
// Log is the logger to use.
Log hclog.Logger
// ShutdownCh is a channel that can be used for shutdown notifications
// for commands.
ShutdownCh chan struct{}
// UI is used to write to the CLI.
UI cli.Ui
}
Command is a base collection of common logic and data embedded in all commands.
func NewCommand ¶
NewCommand returns a new instance of a base.Command type.
func (*Command) WaitForInterrupt ¶
WaitForInterrupt waits for an interrupt signal and runs a provided shutdown function. While the graceful shutdown is in progress, another interrupt can trigger a forced-shutdown and will immediately exit.
Click to show internal directories.
Click to hide internal directories.