예제 #1
0
func main() {
	flag.Parse()

	if flag.NArg() < 1 {
		flag.Usage()
		os.Exit(64)
	}

	s, err := serieslyclient.New(flag.Arg(0))
	maybeFatal(err, "Couldn't set up client: %v", err)

	dbs := flag.Args()[1:]
	if len(dbs) == 0 {
		dbs, err = s.List()
		maybeFatal(err, "Error listing DBs: %v", err)
	}

	tsrc := defaultTemplate
	if *short {
		tsrc = shortTemplate
	}

	tmpl := getTemplate(tsrc)

	tw := tabwriter.NewWriter(os.Stdout, 8, 8, 2, ' ', 0)
	tmpl.Execute(tw, describe(s, dbs...))
	defer tw.Flush()
}
예제 #2
0
func main() {
	flag.Parse()

	httputil.InitHTTPTracker(false)

	if flag.NArg() == 0 {
		log.Fatalf("Seriesly URL required")
	}

	s, err := serieslyclient.New(flag.Arg(0))
	maybeFatal(err, "Parsing %v: %v", flag.Arg(0), err)

	wg := &sync.WaitGroup{}
	ch := make(chan string)

	for i := 0; i < *concurrency; i++ {
		wg.Add(1)
		go dump(wg, s, ch)
	}

	if *dbName == "" {
		dbs, err := s.List()
		maybeFatal(err, "Error listing: %v", err)
		for _, db := range dbs {
			ch <- db
		}
	} else {
		ch <- *dbName
	}
	close(ch)

	wg.Wait()
}