func main() {
	var (
		cpath  = kingpin.Flag("run", "YAML file containing credentials and runtime parameters.").PlaceHolder("FILENAME").Default("./run.yaml").String()
		sample = kingpin.Flag("sample", "Write a sample run.yaml to the current directory.").Bool()
	)
	kingpin.Parse()

	if *sample {
		err := showSample()
		if err != nil {
			panic(err)
		}
		return
	}
	run, err := parseRunYAML(*cpath)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}

	api, err := authenticate(run)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}

	r, err := selectSchema(run)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}
	schema, err := engexport.LoadSchema(r)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}

	err = customFields(api, schema)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}
	dumpSchema(run, *schema)
	p := engexport.P{
		API:            api,
		T:              *schema,
		Tag:            run.Tag,
		Dir:            run.OutDir,
		DisableInclude: run.DisableInclude,
	}

	for _, arg := range run.Args {
		log.Printf("EngExport processing '%v'\n", arg)
		var e *engexport.E
		switch arg {
		case "supporters all":
			e = engexport.NewAllSupporters(p)
		case "supporters active":
			e = engexport.NewActiveSupporter(p)
		case "supporters inactive all":
			e = engexport.NewInactiveSupporter(p)
		case "supporters inactive donors":
			e = engexport.NewInactiveDonors(p)
		case "supporters only_email":
			e = engexport.NewSupporter(p)
		case "supporters no_email":
			e = engexport.NewNoEmailSupporter(p)

		case "groups active":
			e = engexport.NewActiveGroups(p)
		case "groups all":
			e = engexport.NewAllGroups(p)
		case "groups only_email":
			e = engexport.NewEmailOnlyGroups(p)

		case "donations active":
			e = engexport.NewDonation(p)
		case "donations all":
			e = engexport.NewAllDonations(p)

		case "tags":
			e = engexport.NewTagGroups(p)
		case "actions":
			e = engexport.NewAllActions(p)
		case "events":
			e = engexport.NewAllEvents(p)
		case "contact_history":
			e = engexport.NewContactHistory(p)
		case "email_statistics":
			e = engexport.NewEmailStatistics(p)
		case "blast_statistics":
			e = engexport.NewBlastStatistics(p)
		case "chapters all":
			e = engexport.NewAllChapter(p)
		}
		if e == nil {
			log.Println("Error: you *must* choose a table to export!")
			return
		}
		e.Run(engexport.Threads, run.Start)
	}
	log.Println("main: done")
	return
}
//main is the starting point for this app.
main is the starting point for this app.
// main is the starting point for this app .
func main() {
	var (
		cpath  = kingpin.Flag("run", "YAML file containing credentials and runtime parameters.").PlaceHolder("FILENAME").Default("./run.yaml").String()
		sample = kingpin.Flag("sample", "Write a sample run.yaml to the current directory.").Bool()
	)
	kingpin.Parse()
	if *sample {
		err := showSample()
		if err != nil {
			panic(err)
		}
		return
	}
	run, err := parseRunYAML(*cpath)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}
	api, err := authenticate(run)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}
	r, err := selectSchema(run)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}
	schema, err := engexport.LoadSchema(r)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}
	err = customFields(api, schema)
	if err != nil {
		log.Fatalf("Main: %v\n", err)
	}
	dumpSchema(run, *schema)
	p := engexport.P{
		API:            api,
		T:              *schema,
		Tag:            run.Tag,
		Dir:            run.OutDir,
		DisableInclude: run.DisableInclude,
	}
	for _, arg := range run.Args {
		log.Printf("EngExport processing '%v'\n", arg)
		var e *engexport.E
		switch arg {
		case "supporters all":
			e = engexport.NewAllSupporters(p)
		case "supporters active":
			e = engexport.NewActiveSupporter(p)
		case "supporters inactive all":
			e = engexport.NewInactiveSupporter(p)
		case "supporters inactive donors":
			e = engexport.NewInactiveDonors(p)
		case "supporters only_email":
			e = engexport.NewSupporter(p)
		case "supporters no_email":
			e = engexport.NewNoEmailSupporter(p)
		case "groups active":
			e = engexport.NewActiveGroups(p)
		case "groups all":
			e = engexport.NewAllGroups(p)
		case "groups only_email":
			e = engexport.NewEmailOnlyGroups(p)
		case "donations active":
			e = engexport.NewDonation(p)
		case "donations all":
			e = engexport.NewAllDonations(p)
		case "tags":
			e = engexport.NewTagGroups(p)
		case "actions":
			e = engexport.NewAllActions(p)
		case "events":
			e = engexport.NewAllEvents(p)
		case "contact_history":
			e = engexport.NewContactHistory(p)
		case "email_statistics":
			e = engexport.NewEmailStatistics(p)
		case "blast_statistics":
			e = engexport.NewBlastStatistics(p)
		case "chapters all":
			e = engexport.NewAllChapter(p)
		}
		if e == nil {
			log.Println("Error: you *must* choose a table to export!")
			return
		}
		e.Run(engexport.Threads, run.Start)
	}
	log.Println("main: done")
	return
}
func main ( ) { var ( cpath = kingpin . Flag ( " " , " " ) . PlaceHolder ( " " ) . Default ( " " ) . String ( ) sample = kingpin . Flag ( " " , " " ) . Bool ( ) ) kingpin . Parse ( ) if * sample { err := showSample ( ) if err != nil { panic ( err ) } return } run , err := parseRunYAML ( * cpath ) if err != nil { log . Fatalf ( " \n " , err ) } api , err := authenticate ( run ) if err != nil { log . Fatalf ( " \n " , err ) } r , err := selectSchema ( run ) if err != nil { log . Fatalf ( " \n " , err ) } schema , err := engexport . LoadSchema ( r ) if err != nil { log . Fatalf ( " \n " , err ) } err = customFields ( api , schema ) if err != nil { log . Fatalf ( " \n " , err ) } dumpSchema ( run , * schema ) p := engexport . P { API : api , T : * schema , Tag : run . Tag , Dir : run . OutDir , DisableInclude : run . DisableInclude , } for _ , arg := range run . Args { log . Printf ( " \n " , arg ) var e * engexport . E switch arg { case " " : e = engexport . NewAllSupporters ( p ) case " " : e = engexport . NewActiveSupporter ( p ) case " " : e = engexport . NewInactiveSupporter ( p ) case " " : e = engexport . NewInactiveDonors ( p ) case " " : e = engexport . NewSupporter ( p ) case " " : e = engexport . NewNoEmailSupporter ( p ) case " " : e = engexport . NewActiveGroups ( p ) case " " : e = engexport . NewAllGroups ( p ) case " " : e = engexport . NewEmailOnlyGroups ( p ) case " " : e = engexport . NewDonation ( p ) case " " : e = engexport . NewAllDonations ( p ) case " " : e = engexport . NewTagGroups ( p ) case " " : e = engexport . NewAllActions ( p ) case " " : e = engexport . NewAllEvents ( p ) case " " : e = engexport . NewContactHistory ( p ) case " " : e = engexport . NewEmailStatistics ( p ) case " " : e = engexport . NewBlastStatistics ( p ) case " " : e = engexport . NewAllChapter ( p ) } if e == nil { log . Println ( " " ) return } e . Run ( engexport . Threads , run . Start ) } log . Println ( " " ) return }
main is the starting point for this app.
main is the starting point for this app .