generate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSpecWithSpinner

func GenerateSpecWithSpinner(
	project *v1.Project,
	stack *v1.Stack,
	workspace *v1.Workspace,
	parameters map[string]string,
	ui *terminal.UI,
	noStyle bool,
) (*v1.Spec, error)

GenerateSpecWithSpinner calls generator to generate versioned Spec. Add a method wrapper for testing purposes.

func NewCmdGenerate

func NewCmdGenerate(ui *terminal.UI, ioStreams genericiooptions.IOStreams) *cobra.Command

NewCmdGenerate creates the `generate` command.

func SpecFromFile

func SpecFromFile(filePath string) (*v1.Spec, error)

Types

type GenerateFlags

type GenerateFlags struct {
	MetaFlags *meta.MetaFlags

	Output  string
	Values  []string
	NoStyle bool

	UI *terminal.UI

	genericiooptions.IOStreams
}

GenerateFlags directly reflect the information that CLI is gathering via flags. They will be converted to GenerateOptions, which reflect the runtime requirements for the command.

This structure reduces the transformation to wiring and makes the logic itself easy to unit test.

func NewGenerateFlags

func NewGenerateFlags(ui *terminal.UI, streams genericiooptions.IOStreams) *GenerateFlags

NewGenerateFlags returns a default GenerateFlags

func (*GenerateFlags) AddFlags

func (flags *GenerateFlags) AddFlags(cmd *cobra.Command)

AddFlags registers flags for a cli.

func (*GenerateFlags) ToOptions

func (flags *GenerateFlags) ToOptions() (*GenerateOptions, error)

ToOptions converts from CLI inputs to runtime inputs.

type GenerateOptions

type GenerateOptions struct {
	*meta.MetaOptions

	Output  string
	Values  []string
	NoStyle bool

	UI *terminal.UI

	genericiooptions.IOStreams
}

GenerateOptions defines flags and other configuration parameters for the `generate` command.

func (*GenerateOptions) Run

func (o *GenerateOptions) Run() error

Run executes the `generate` command.

func (*GenerateOptions) Validate

func (o *GenerateOptions) Validate(cmd *cobra.Command, args []string) error

Validate verifies if GenerateOptions are valid and without conflicts.

Jump to

Keyboard shortcuts

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