gen

package
v0.0.0-...-d2fd310 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "gen",
	Short:   "Generate IOC bean register code.",
	Long:    "Generate IOC bean register code.",
	Example: `ioctl gen ...`,
	RunE: func(cmd *cobra.Command, rawOpts []string) error {
		fmt.Printf("prepare to generate IOC bean register code")
		switch len(rawOpts) {
		case 0:
			rawOpts = []string{"register", "paths=./..."}
		case 1:
			rawOpts = append(rawOpts, "register")
		}

		rt, err := genall.FromOptions(optionsRegistry, rawOpts)
		if err != nil {
			return err
		}
		if len(rt.Generators) == 0 {
			return fmt.Errorf("no generators specified")
		}

		if hadErrs := rt.Run(); hadErrs {

			return NoUsageError{fmt.Errorf("not all generators ran successfully")}
		}

		return nil
	},
}

Functions

This section is empty.

Types

type NoUsageError

type NoUsageError struct {
	// contains filtered or unexported fields
}

NoUsageError suppresses usage printing when it occurs (since cobra doesn't provide a good way to avoid printing out usage in only certain situations).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL