Documentation ¶
Overview ¶
Package cmd contains everything needed for a command to function properly, including providing user feedback as well as taking user input.
Index ¶
- func IsUserAbortedError(err error) bool
- func NewRestoreCommand(dbConnect func(info db.DialInfo) (core.Database, error), ...) cmd.Command
- func ReadCredsFromAgentConf() (string, string, error)
- func ReadCredsFromPattern(pattern string, readFile func(string) ([]byte, error)) (string, string, error)
- type UserInteractions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUserAbortedError ¶
IsUserAbortedError returns true if err is of type userAbortedError.
func NewRestoreCommand ¶
func NewRestoreCommand( dbConnect func(info db.DialInfo) (core.Database, error), openBackup func(path, tempRoot string) (core.BackupFile, error), machineConverter func(member core.ReplicaSetMember) core.ControllerNode, loadCreds func() (string, string, error), devMode bool, ) cmd.Command
NewRestoreCommand creates a cmd.Command to check the database and restore the Juju backup.
func ReadCredsFromAgentConf ¶
ReadCredsFromAgentConf tries to load a mongo username and password from the standard agent.conf location on a controller machine.
Types ¶
type UserInteractions ¶
type UserInteractions struct {
// contains filtered or unexported fields
}
UserInteractions communicates with the user by providing feedback and by collecting user input.
func NewUserInteractions ¶
func NewUserInteractions(ctx *cmd.Context) *UserInteractions
NewUserInteractions constructs user interactions with given context.
func (*UserInteractions) Notify ¶
func (ui *UserInteractions) Notify(message string)
Notify will post message to an io.Writer of the given cmd.Context. This ensures that all messages that require user attention go consistently to the same writer.
func (*UserInteractions) UserConfirmYes ¶
func (ui *UserInteractions) UserConfirmYes() error
UserConfirmYes returns an error if we do not read a "y" or "yes" from user input.