Пример #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{},
	)
}
Пример #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...,
	)
}
Пример #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{},
	)
}
Пример #4
0
func main() {
	env.Main(do, &appEnv{})
}
Пример #5
0
func main() {
	env.Main(do, &appEnv{}, defaultEnv)
}