// Main is the main function for commands. func Main(generateHelper GenerateHelper) { env.Main( func(generateEnvObj interface{}) error { return generate(nil, generateHelper, generateEnvObj.(*GenerateEnv)) }, &GenerateEnv{}, ) }
// 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..., ) }
// 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{}, ) }
func main() { env.Main(do, &appEnv{}) }
func main() { env.Main(do, &appEnv{}, defaultEnv) }