config

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigFileName = "easyp.yaml"
)

Variables

View Source
var (
	FlagCfg = &cli.StringFlag{
		Name:       "cfg",
		Usage:      "set config file path",
		Required:   true,
		HasBeenSet: true,
		Value:      DefaultConfigFileName,
		Aliases:    []string{"config"},
		EnvVars:    []string{"EASYP_CFG"},
	}

	FlagDebug = &cli.BoolFlag{
		Name:       "debug",
		Usage:      "set config file path",
		Required:   false,
		HasBeenSet: false,
		Value:      false,
		Aliases:    []string{"d"},
		EnvVars:    []string{"DEBUG"},
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// LintConfig is the lint configuration.
	Lint LintConfig `json:"lint" yaml:"lint"`

	// Deps is the dependencies repositories
	Deps []string `json:"deps" yaml:"deps"`

	// Generate is the generate configuration.
	Generate Generate `json:"generate" yaml:"generate"`
}

Config is the configuration of easyp.

func ReadConfig

func ReadConfig(ctx *cli.Context) (*Config, error)

ReadConfig reads the configuration from the file.

func (*Config) BuildLinterRules

func (cfg *Config) BuildLinterRules() ([]lint.Rule, error)

type DependencyEntryPoint added in v0.4.2

type DependencyEntryPoint struct {
	Dep  string `json:"dep" yaml:"dep"`
	Path string `json:"path" yaml:"path"`
}

DependencyEntryPoint part for generate code from dep

type Generate added in v0.4.0

type Generate struct {
	DependencyEntryPoint *DependencyEntryPoint `json:"dependency_entry_point" yaml:"dependency_entry_point"`
	Inputs               []Input               `json:"inputs" yaml:"inputs"`
	Plugins              []Plugin              `json:"plugins" yaml:"plugins"`
}

Generate is the configuration of the generate command.

type Input added in v0.6.5

type Input struct {
	Directory string       `yaml:"directory"`
	GitRepo   InputGitRepo `yaml:"git_repo"`
}

Input source for generating code.

type InputDirectory added in v0.6.5

type InputDirectory struct {
	Path string `yaml:"path"`
}

InputDirectory is the configuration of the directory.

type InputGitRepo added in v0.6.5

type InputGitRepo struct {
	URL          string `yaml:"url"`
	Branch       string `yaml:"branch"`
	SubDirectory string `yaml:"sub_directory"`
}

InputGitRepo is the configuration of the git repository.

type LintConfig

type LintConfig struct {
	Use                 []string            `json:"use" yaml:"use" env:"USE"`                                                          // Use rules for linter.
	EnumZeroValueSuffix string              `json:"enum_zero_value_suffix" yaml:"enum_zero_value_suffix" env:"ENUM_ZERO_VALUE_SUFFIX"` // Enum zero value suffix.
	ServiceSuffix       string              `json:"service_suffix" yaml:"service_suffix" env:"SERVICE_SUFFIX"`                         // Service suffix.
	Ignore              []string            `json:"ignore" yaml:"ignore" env:"IGNORE"`                                                 // Ignore dirs with proto file.
	Except              []string            `json:"except" yaml:"except" env:"EXCEPT"`                                                 // Except linter rules.
	AllowCommentIgnores bool                `json:"allow_comment_ignores" yaml:"allow_comment_ignores" env:"ALLOW_COMMENT_IGNORES"`    // Allow comment ignore.
	IgnoreOnly          map[string][]string `json:"ignore_only" yaml:"ignore_only" env:"IGNORE_ONLY"`
}

LintConfig contains linter configuration.

type Plugin added in v0.4.0

type Plugin struct {
	Name string            `json:"name" yaml:"name"`
	Out  string            `json:"out" yaml:"out"`
	Opts map[string]string `json:"opts" yaml:"opts"`
}

Plugin is the configuration of the plugin.

Jump to

Keyboard shortcuts

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