cmd

package
v3.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCfgFileNotFound = errors.New("config file not found")

Functions

func Execute

func Execute()

Execute executes the cobra CLI workflow

func NewInitCmd

func NewInitCmd() *cobra.Command

func NewMigrateCmd

func NewMigrateCmd() *cobra.Command

func NewRootCmd

func NewRootCmd() (*cobra.Command, error)

func NewShowConfigCmd

func NewShowConfigCmd() *cobra.Command

func NewVersionCmd

func NewVersionCmd() *cobra.Command

Types

type CollectionConfig added in v3.5.0

type CollectionConfig struct {
	InPackage                   *bool
	OutFilePath                 string
	OutPkgName                  string
	SrcPkgPath                  string
	Template                    string
	TemplateSchema              string
	RequireTemplateSchemaExists bool
}

CollectionConfig contains the common, file-global configuration parameters for an InterfaceCollection. Some mockery config parameters are attributes of the entire file, rather than specific interfaces. For such attributes, we must assert that all interfaces within a collection have these values identically set.

type InterfaceCollection

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

InterfaceCollection maintains a list of *pkg.Interface and asserts that all the interfaces in the collection belong to the same source package. It also asserts that various properties of the interfaces added to the collection are uniform.

func NewInterfaceCollection

func NewInterfaceCollection(
	srcPkgPath string,
	outFilePath string,
	srcPkg *packages.Package,
	outPkgName string,
	template string,
	templateSchema string,
	inPackage *bool,
	requireTemplateSchemaExists bool,
) *InterfaceCollection

func (*InterfaceCollection) Append

func (i *InterfaceCollection) Append(ctx context.Context, iface *internal.Interface) error

type RootApp

type RootApp struct {
	Config config.RootConfig
}

func GetRootApp

func GetRootApp(ctx context.Context, flags *pflag.FlagSet) (*RootApp, error)

func (*RootApp) Run

func (r *RootApp) Run() error

type V2Config

type V2Config struct {
	All                         *bool          `yaml:"all"`
	Anchors                     map[string]any `yaml:"_anchors"`
	BoilerplateFile             *string        `yaml:"boilerplate-file"` // MOVED: moved to `template-data.boilerplate-file`
	BuildTags                   *string        `yaml:"tags"`             // DELETED: use mock-build-tags instead
	Case                        *string        `yaml:"case"`             // DELETED: caseness is specified using template variables/functions in `structname`.
	Config                      *string        `yaml:"config"`
	Cpuprofile                  *string        `yaml:"cpuprofile"` // DELETED: not an option in v3
	Dir                         *string        `yaml:"dir"`
	DisableConfigSearch         *bool          `yaml:"disable-config-search"` // DEPRECATED: permanently set to `false` in v3
	DisableDeprecationWarnings  *bool          `yaml:"disable-deprecation-warnings"`
	DisabledDeprecationWarnings *[]string      `yaml:"disabled-deprecation-warnings"`
	DisableFuncMocks            *bool          `yaml:"disable-func-mocks"`     // DEPRECATED: func-mocks no longer generated.
	DisableVersionString        *bool          `yaml:"disable-version-string"` // DEPRECATED: set to true in v3
	DryRun                      *bool          `yaml:"dry-run"`
	Exclude                     []string       `yaml:"exclude"` // MOVED: moved to `exclude-subpkg-regex` in v3
	ExcludeRegex                *string        `yaml:"exclude-regex"`
	Exported                    *bool          `yaml:"exported"`        // DELETED: Use templated parameters to define upper/lower case-ness of mock names.
	FailOnMissing               *bool          `yaml:"fail-on-missing"` // DEPRECATED: set to true permanently in v3
	FileName                    *string        `yaml:"filename"`
	InPackage                   *bool          `yaml:"inpackage"`              // DELETED: mockery automatically detects the appropriate value for the parameter.
	InPackageSuffix             *bool          `yaml:"inpackage-suffix"`       // DELETED: Use `packages` config.
	IncludeAutoGenerated        *bool          `yaml:"include-auto-generated"` // DELETED: not supported in v3. PRs to port functionality to v3 welcome.
	IncludeRegex                *string        `yaml:"include-regex"`
	Issue845Fix                 *bool          `yaml:"issue-845-fix"` // DEPRECATED: set to true in v3
	KeepTree                    *bool          `yaml:"keeptree"`      // DELETED: mockery uses templated parameters to specify directory and filename locations.
	LogLevel                    *string        `yaml:"log-level"`
	MockBuildTags               *string        `yaml:"mock-build-tags"` // MOVED: moved to `template-data.mock-build-tags`
	MockName                    *string        `yaml:"mockname"`
	Name                        *string        `yaml:"name"`          // DELETED: not supported
	Note                        *string        `yaml:"note"`          // DELETED: not supported
	Outpkg                      *string        `yaml:"outpkg"`        // DEPRECATED: Use `pkgname` instead
	Output                      *string        `yaml:"output"`        // DELETED: Use `packages` config
	Packageprefix               *string        `yaml:"packageprefix"` // DEPRECATED: use `pkgname`
	Print                       *bool          `yaml:"print"`         // DEPRECATED: printing mocks not an option
	Profile                     *string        `yaml:"profile"`       // DELETED: not an option in v3
	Quiet                       *bool          `yaml:"quiet"`         // DEPRECATED: deleted in v3 in favor of log-level
	Recursive                   *bool          `yaml:"recursive"`
	ReplaceType                 []string       `yaml:"replace-type"`       // DEPRECATED: moved to new schema in v3
	ResolveTypeAlias            *bool          `yaml:"resolve-type-alias"` // DEPRECATED: permanently set to false in v3
	SrcPkg                      *string        `yaml:"srcpkg"`             // DELETED: Use `packages` config.
	StructName                  *string        `yaml:"structname"`         // MOVED: moved to `structname` in v3
	TestOnly                    *bool          `yaml:"testonly"`           // DEPRECATED: use `filename` to generate `_test.go` suffix.
	UnrollVariadic              *bool          `yaml:"unroll-variadic"`    // MOVED: moved to `template-data.unroll-variadic`
	Version                     *bool          `yaml:"version"`
	WithExpecter                *bool          `yaml:"with-expecter"` // DEPRECATED: set to true in v3
}

type V2InterfaceConfig

type V2InterfaceConfig struct {
	Config  *V2Config  `yaml:"config"`
	Configs []V2Config `yaml:"configs"`
}

type V2PackageConfig

type V2PackageConfig struct {
	Config     *V2Config                    `yaml:"config"`
	Interfaces map[string]V2InterfaceConfig `yaml:"interfaces"`
}

type V2RootConfig

type V2RootConfig struct {
	V2Config `yaml:",inline"`
	Packages map[string]V2PackageConfig `yaml:"packages"`
}

Jump to

Keyboard shortcuts

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