Example #1
0
func handleIsOnline(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),
		}
	}

	fmt.Println(status)
	return nil
}
Example #2
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
}