Ejemplo n.º 1
0
func handleOnline(ctx *cli.Context, client *daemon.Client) error {
	status, err := client.IsOnline()
	if err != nil {
		return ExitCode{
			UnknownError,
			fmt.Sprintf("Failed to check online-status: %v", err),
		}
	}

	if status {
		log.Infof("Already online.")
		return nil
	}

	if err := client.Online(); err != nil {
		return ExitCode{
			UnknownError,
			fmt.Sprintf("Failed to go online: %v", err),
		}
	}

	return nil
}