예제 #1
0
파일: list.go 프로젝트: ngaut/gen
func listStandard() error {
	app, err := typewriter.NewApp("+gen")

	if err != nil {
		return err
	}

	fmt.Fprintln(out, "Installed typewriters:")
	for _, tw := range app.TypeWriters {
		fmt.Fprintf(out, "  %s\n", tw.Name())
	}

	return nil
}
예제 #2
0
파일: run.go 프로젝트: ngaut/gen
func runStandard() error {
	app, err := typewriter.NewApp("+gen")

	if err != nil {
		return err
	}

	if len(app.Types) == 0 {
		return fmt.Errorf("No types marked with +gen were found. See http://clipperhouse.github.io/gen to get started, or type %s help.", os.Args[0])
	}

	if len(app.TypeWriters) == 0 {
		return fmt.Errorf("No typewriters were imported. See http://clipperhouse.github.io/gen to get started, or type %s help.", os.Args[0])
	}

	if err := app.WriteAll(); err != nil {
		return err
	}

	return nil
}