Example #1
0
// Main is the main function for commands.
func Main(generateHelper GenerateHelper) {
	env.Main(
		func(generateEnvObj interface{}) error {
			return generate(nil, generateHelper, generateEnvObj.(*GenerateEnv))
		},
		&GenerateEnv{},
	)
}
Example #2
0
// Main runs env.Main along with Setup.
func Main(do func(interface{}) error, appEnv interface{}, decoders ...env.Decoder) {
	env.Main(
		func(appEnvObj interface{}) error {
			if err := Setup(); err != nil {
				return err
			}
			return do(appEnvObj)
		},
		appEnv,
		decoders...,
	)
}
Example #3
0
// CSVMain is the main function for csv commands.
func CSVMain(csvGenerateHelper CSVGenerateHelper) {
	env.Main(
		func(csvGenerateEnvObj interface{}) error {
			csvGenerateEnv := csvGenerateEnvObj.(*CSVGenerateEnv)
			records, err := getCSVRecords(filepath.Join(csvGenerateEnv.GenerateEnv.RepoDir, csvGenerateEnv.CSVFile))
			if err != nil {
				return err
			}
			data, err := csvGenerateHelper.TmplData(records)
			if err != nil {
				return err
			}
			return generate(data, csvGenerateHelper, &csvGenerateEnv.GenerateEnv)
		},
		&CSVGenerateEnv{},
	)
}
Example #4
0
func main() {
	env.Main(do, &appEnv{})
}
Example #5
0
func main() {
	env.Main(do, &appEnv{}, defaultEnv)
}