new

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package used to generate demo command code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdNew

func NewCmdNew(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command

NewCmdNew returns new initialized instance of 'new' sub command.

Types

type NewOptions

type NewOptions struct {
	Group  bool
	Outdir string

	// command template options, will render to command template
	CommandName         string
	CommandDescription  string
	CommandFunctionName string
	Dot                 string

	genericclioptions.IOStreams
}

NewOptions is an options struct to support 'new' sub command.

func NewNewOptions

func NewNewOptions(ioStreams genericclioptions.IOStreams) *NewOptions

NewNewOptions returns an initialized NewOptions instance.

func (*NewOptions) Complete

func (o *NewOptions) Complete(cmd *cobra.Command, args []string) error

Complete completes all the required options.

func (*NewOptions) CreateCommand

func (o *NewOptions) CreateCommand() error

CreateCommand create the command with options.

func (*NewOptions) CreateCommandWithSubCommands

func (o *NewOptions) CreateCommandWithSubCommands() error

CreateCommandWithSubCommands create sub commands with options.

func (*NewOptions) GenerateGoCode

func (o *NewOptions) GenerateGoCode(name, codeTemplate string) error

GenerateGoCode generate go source file.

func (*NewOptions) Run

func (o *NewOptions) Run(args []string) error

Run executes a new sub command using the specified options.

func (*NewOptions) Validate

func (o *NewOptions) Validate(cmd *cobra.Command) error

Validate makes sure there is no discrepency in command options.

Jump to

Keyboard shortcuts

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