Example #1
0
func NewFlagsWithPrefix(prefix string) DatasetFlags {
	return DatasetFlags{
		datas.NewFlagsWithPrefix(prefix),
		flag.String(prefix+"ds", "", "dataset id to store data for"),
	}
}
Example #2
0
import (
	"flag"
	"log"
	"runtime"

	"github.com/attic-labs/noms/clients/util"
	"github.com/attic-labs/noms/d"
	"github.com/attic-labs/noms/datas"
	"github.com/attic-labs/noms/dataset"
	"github.com/attic-labs/noms/ref"
)

var (
	p                = flag.Uint("p", 512, "parallelism")
	sinkDsFlags      = dataset.NewFlagsWithPrefix("sink-")
	sourceStoreFlags = datas.NewFlagsWithPrefix("source-")
	sourceObject     = flag.String("source", "", "source object to sync - either a dataset name or a ref")
)

func main() {
	cpuCount := runtime.NumCPU()
	runtime.GOMAXPROCS(cpuCount)

	flag.Parse()

	sourceStore, ok := sourceStoreFlags.CreateDataStore()
	sink := sinkDsFlags.CreateDataset()
	if !ok || sink == nil || *p == 0 || *sourceObject == "" {
		flag.Usage()
		return
	}