Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions commands/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,24 @@ func (cmd *BaseCommand) Before(c *cli.Context) error {

// Success encapsulates the functionality for reporting command success
func (cmd *BaseCommand) Success(message string) error {
// Handle success messaging.
// Handle success messaging. If the spinner is running or not, this will
// output accordingly and issue a notification.
if message != "" {
cmd.out.Info(message)
util.NotifySuccess(cmd.context, message)
}

// If there is an active spinner wrap it up. This is not placed before the logging above so commands can rely on
// cmd.Success to set the last spinner status in lieu of an extraneous log entry.
cmd.out.NoSpin()

return nil
}

// Failure encapsulates the functionality for reporting command failure
func (cmd *BaseCommand) Failure(message string, errorName string, exitCode int) error {
// Make sure any running spinner halts.
cmd.out.NoSpin()
// If the spinner is running, output something to get closure and shut it down.
if cmd.out.Spinning {
cmd.out.Error(message)
fmt.Println()
}

// Handle error messaging.
util.NotifyError(cmd.context, message)
// Print expanded troubleshooting guidance.
Expand Down
4 changes: 1 addition & 3 deletions commands/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ func (cmd *Start) Run(c *cli.Context) error {
cmd.out.Error("Docker could not be started")
return cmd.Failure(err.Error(), "MACHINE-START-FAILED", 12)
}
cmd.out.Info("Docker Machine (%s) Created", cmd.machine.Name)

cmd.out.Verbose("Configuring the local Docker environment")
cmd.machine.SetEnv()
cmd.out.Info("Docker Machine is ready")
cmd.out.Info("Docker Machine (%s) Created", cmd.machine.Name)

dns := DNS{cmd.BaseCommand}
dns.StartDNS(cmd.machine, c.String("nameservers"))
Expand Down Expand Up @@ -148,7 +147,6 @@ func (cmd *Start) Run(c *cli.Context) error {

cmd.out.Info("Run 'eval \"$(rig config)\"' to execute docker or docker-compose commands in your terminal.")
return cmd.Success("Outrigger is ready to use")

}

// StartMinimal will start "minimal" Outrigger operations, which refers to environments where
Expand Down
3 changes: 3 additions & 0 deletions util/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (log *RigLogger) Info(format string, a ...interface{}) {
} else {
log.Progress.Spins.SetMessage(fmt.Sprintf(format, a...))
log.Progress.Spins.Succeed()
log.Spinning = false
}
}

Expand All @@ -123,6 +124,7 @@ func (log *RigLogger) Warning(format string, a ...interface{}) {
} else {
log.Progress.Spins.SetMessage(fmt.Sprintf(format, a...))
log.Progress.Spins.Warn()
log.Spinning = false
}
}

Expand All @@ -138,6 +140,7 @@ func (log *RigLogger) Error(format string, a ...interface{}) {
} else {
log.Progress.Spins.SetMessage(fmt.Sprintf(format, a...))
log.Progress.Spins.Fail()
log.Spinning = false
}
}

Expand Down