예제 #1
0
func handleRemoteList(ctx *cli.Context, client *daemon.Client) error {
	data, err := client.RemoteList()
	if err != nil {
		return ExitCode{
			UnknownError,
			fmt.Sprintf("Unable to list remotes: %v", err),
		}
	}
	for _, entry := range data {
		printRemoteEntry(entry)
	}
	return nil
}
예제 #2
0
func handleSync(ctx *cli.Context, client *daemon.Client) error {
	// With no arguments, we should sync with everyone around.
	if len(ctx.Args()) != 0 {
		// Pass over to single ID handling:
		return handleSyncSingle(ctx, client, ctx.Args().First())
	}

	// Iterate over all remotes brigd knows about:
	data, err := client.RemoteList()
	if err != nil {
		return ExitCode{
			UnknownError,
			fmt.Sprintf("Unable to list remotes: %v", err),
		}
	}

	for _, entry := range data {
		if err := handleSyncSingle(ctx, client, entry.Ident); err != nil {
			return err
		}
	}

	return nil
}