Exemple #1
0
func handleRemoteAdd(ctx *cli.Context, client *daemon.Client) error {
	idString, hash := ctx.Args()[0], ctx.Args()[1]

	id, err := id.Cast(idString)
	if err != nil {
		return ExitCode{
			BadArgs,
			fmt.Sprintf("Invalid ID: %v", err),
		}
	}

	if err := client.RemoteAdd(id, hash); err != nil {
		return ExitCode{
			UnknownError,
			fmt.Sprintf("Unable to add remote: %v", err),
		}
	}

	return nil
}