gencli

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Code generated by github.com/bcdxn/opencli@unknown version DO NOT EDIT.

Index

Constants

View Source
const (
	ExitCodeOK              int = 0
	ExitCodeInternalErr     int = 1
	ExitCodeBadUserInputErr int = 2
)

Variables

This section is empty.

Functions

func DefaultHelpFunc

func DefaultHelpFunc(a ActionsInterface, cmd *spec.CommandItem)

DefaultHelpFunc renders contextual help for cmd to the actions IOStreams output.

func DefaultUsageFunc

func DefaultUsageFunc(a ActionsInterface, cmd *spec.CommandItem) error

DefaultUsageFunc renders contextual usage for cmd to the actions IOStreams output.

func NewCmdPetstore

func NewCmdPetstore(a ActionsInterface) *cobra.Command

func NewCmdPetstoreList

func NewCmdPetstoreList(a ActionsInterface) *cobra.Command

func NewCmdPetstorePet

func NewCmdPetstorePet(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetAdd

func NewCmdPetstorePetAdd(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetDelete

func NewCmdPetstorePetDelete(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetFindByStatus

func NewCmdPetstorePetFindByStatus(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetFindByTags

func NewCmdPetstorePetFindByTags(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetGet

func NewCmdPetstorePetGet(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetUpdate

func NewCmdPetstorePetUpdate(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetUpdateForm

func NewCmdPetstorePetUpdateForm(a ActionsInterface) *cobra.Command

func NewCmdPetstorePetUploadImage

func NewCmdPetstorePetUploadImage(a ActionsInterface) *cobra.Command

func NewCmdPetstoreStore

func NewCmdPetstoreStore(a ActionsInterface) *cobra.Command

func NewCmdPetstoreStoreInventory

func NewCmdPetstoreStoreInventory(a ActionsInterface) *cobra.Command

func NewCmdPetstoreStoreOrder

func NewCmdPetstoreStoreOrder(a ActionsInterface) *cobra.Command

func NewCmdPetstoreStoreOrderDelete

func NewCmdPetstoreStoreOrderDelete(a ActionsInterface) *cobra.Command

func NewCmdPetstoreStoreOrderGet

func NewCmdPetstoreStoreOrderGet(a ActionsInterface) *cobra.Command

func NewCmdPetstoreStoreOrderPlace

func NewCmdPetstoreStoreOrderPlace(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUser

func NewCmdPetstoreUser(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUserCreate

func NewCmdPetstoreUserCreate(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUserCreateWithList

func NewCmdPetstoreUserCreateWithList(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUserDelete

func NewCmdPetstoreUserDelete(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUserGet

func NewCmdPetstoreUserGet(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUserLogin

func NewCmdPetstoreUserLogin(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUserLogout

func NewCmdPetstoreUserLogout(a ActionsInterface) *cobra.Command

func NewCmdPetstoreUserUpdate

func NewCmdPetstoreUserUpdate(a ActionsInterface) *cobra.Command

func Run

func Run(ctx context.Context, actions ActionsInterface) int

Run executes the root cobra command and returns an exit code.

Types

type ActionsInterface

type ActionsInterface interface {
	PetstoreList(ctx context.Context, args PetstoreListArgs) error
	PetstorePetAdd(ctx context.Context, args PetstorePetAddArgs, flags PetstorePetAddFlags) error
	PetstorePetUpdate(ctx context.Context, args PetstorePetUpdateArgs, flags PetstorePetUpdateFlags) error
	PetstorePetFindByStatus(ctx context.Context, flags PetstorePetFindByStatusFlags) error
	PetstorePetFindByTags(ctx context.Context, flags PetstorePetFindByTagsFlags) error
	PetstorePetGet(ctx context.Context, flags PetstorePetGetFlags) error
	PetstorePetUpdateForm(ctx context.Context, flags PetstorePetUpdateFormFlags) error
	PetstorePetDelete(ctx context.Context, flags PetstorePetDeleteFlags) error
	PetstorePetUploadImage(ctx context.Context, args PetstorePetUploadImageArgs, flags PetstorePetUploadImageFlags) error
	PetstoreStoreInventory(ctx context.Context) error
	PetstoreStoreOrderPlace(ctx context.Context, args PetstoreStoreOrderPlaceArgs, flags PetstoreStoreOrderPlaceFlags) error
	PetstoreStoreOrderGet(ctx context.Context, flags PetstoreStoreOrderGetFlags) error
	PetstoreStoreOrderDelete(ctx context.Context, args PetstoreStoreOrderDeleteArgs) error
	PetstoreUserCreate(ctx context.Context, args PetstoreUserCreateArgs, flags PetstoreUserCreateFlags) error
	PetstoreUserCreateWithList(ctx context.Context, args PetstoreUserCreateWithListArgs) error
	PetstoreUserLogin(ctx context.Context, flags PetstoreUserLoginFlags) error
	PetstoreUserLogout(ctx context.Context) error
	PetstoreUserGet(ctx context.Context, flags PetstoreUserGetFlags) error
	PetstoreUserUpdate(ctx context.Context, flags PetstoreUserUpdateFlags) error
	PetstoreUserDelete(ctx context.Context, flags PetstoreUserDeleteFlags) error
	HelpFunc(cmd *spec.CommandItem)
	UsageFunc(cmd *spec.CommandItem) error
	IOStreams() IOStreams
	Version() string
}

ActionsInterface defines all actions the petstore CLI supports.

type CLIError

type CLIError struct {
	Code      int
	Message   string
	UsageFunc UsageFunc
}

CLIError represents a CLI error with an exit code and an optional usage function.

func BadUserInput

func BadUserInput(message string, usageFn UsageFunc) *CLIError

BadUserInput creates a new CLIError with the bad user input exit code.

func InternalError

func InternalError(message string, usageFn UsageFunc) *CLIError

InternalError creates a new CLIError with the internal error exit code.

func (CLIError) Error

func (err CLIError) Error() string

type DefaultIOStreams

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

DefaultIOStreams is the default implementation of IOStreams backed by os.Stdin/Stdout/Stderr.

func (DefaultIOStreams) ErrOut

func (ios DefaultIOStreams) ErrOut() FileWriter

func (DefaultIOStreams) In

func (ios DefaultIOStreams) In() FileReader

func (DefaultIOStreams) Out

func (ios DefaultIOStreams) Out() FileWriter

func (DefaultIOStreams) TerminalSize

func (ios DefaultIOStreams) TerminalSize() (int, int, error)

func (DefaultIOStreams) TerminalTheme

func (ios DefaultIOStreams) TerminalTheme() string

type DefaultTerminal

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

DefaultTerminal is the default Terminal implementation backed by the real OS terminal.

func (*DefaultTerminal) Is256ColorSupported

func (t *DefaultTerminal) Is256ColorSupported() bool

func (*DefaultTerminal) IsTerminalOutput

func (t *DefaultTerminal) IsTerminalOutput() bool

func (*DefaultTerminal) IsTrueColorSupported

func (t *DefaultTerminal) IsTrueColorSupported() bool

func (*DefaultTerminal) Size

func (t *DefaultTerminal) Size() (int, int, error)

func (*DefaultTerminal) Theme

func (t *DefaultTerminal) Theme() string

type FileReader

type FileReader interface {
	io.ReadCloser
	Fd() uintptr
}

FileReader is an io.ReadCloser that exposes the underlying file descriptor.

type FileWriter

type FileWriter interface {
	io.Writer
	Fd() uintptr
}

FileWriter is an io.Writer that exposes the underlying file descriptor.

type IOStreams

type IOStreams interface {
	In() FileReader
	Out() FileWriter
	ErrOut() FileWriter
	TerminalTheme() string
	TerminalSize() (int, int, error)
}

IOStreams provides access to the standard I/O streams.

func DefaultIOS

func DefaultIOS() IOStreams

DefaultIOS returns an IOStreams backed by the real os.Stdin/Stdout/Stderr.

func TestIOS

func TestIOS() (IOStreams, *bytes.Buffer, *bytes.Buffer, *bytes.Buffer)

TestIOS returns an IOStreams backed by bytes.Buffer for use in tests.

type PetstoreListArgs

type PetstoreListArgs struct {
	HttpArguments string
}

PetstoreListArgs holds the positional arguments for the PetstoreList action.

type PetstorePetAddArgs

type PetstorePetAddArgs struct {
	PathToReqBody string
}

PetstorePetAddArgs holds the positional arguments for the PetstorePetAdd action.

type PetstorePetAddFlags

type PetstorePetAddFlags struct {
	Name      string
	PhotoUrls []string
	Status    PetstorePetAddStatus
	Tag       []string
}

PetstorePetAddFlags holds the flag values for the PetstorePetAdd action.

type PetstorePetAddStatus

type PetstorePetAddStatus string

PetstorePetAddStatus represents the allowed values for the Status flag.

const (
	PetstorePetAddStatusAvailable PetstorePetAddStatus = "available"
	PetstorePetAddStatusPending   PetstorePetAddStatus = "pending"
	PetstorePetAddStatusSold      PetstorePetAddStatus = "sold"
)

func (PetstorePetAddStatus) IsValid

func (v PetstorePetAddStatus) IsValid() bool

type PetstorePetDeleteFlags

type PetstorePetDeleteFlags struct {
	Id     int64
	ApiKey string
}

PetstorePetDeleteFlags holds the flag values for the PetstorePetDelete action.

type PetstorePetFindByStatusFlags

type PetstorePetFindByStatusFlags struct {
	Status PetstorePetFindByStatusStatus
}

PetstorePetFindByStatusFlags holds the flag values for the PetstorePetFindByStatus action.

type PetstorePetFindByStatusStatus

type PetstorePetFindByStatusStatus string

PetstorePetFindByStatusStatus represents the allowed values for the Status flag.

const (
	PetstorePetFindByStatusStatusAvailable PetstorePetFindByStatusStatus = "available"
	PetstorePetFindByStatusStatusPending   PetstorePetFindByStatusStatus = "pending"
	PetstorePetFindByStatusStatusSold      PetstorePetFindByStatusStatus = "sold"
)

func (PetstorePetFindByStatusStatus) IsValid

func (v PetstorePetFindByStatusStatus) IsValid() bool

type PetstorePetFindByTagsFlags

type PetstorePetFindByTagsFlags struct {
	Tags []string
}

PetstorePetFindByTagsFlags holds the flag values for the PetstorePetFindByTags action.

type PetstorePetGetFlags

type PetstorePetGetFlags struct {
	Id int64
}

PetstorePetGetFlags holds the flag values for the PetstorePetGet action.

type PetstorePetUpdateArgs

type PetstorePetUpdateArgs struct {
	PathToReqBody string
}

PetstorePetUpdateArgs holds the positional arguments for the PetstorePetUpdate action.

type PetstorePetUpdateFlags

type PetstorePetUpdateFlags struct {
	Name      string
	Status    PetstorePetUpdateStatus
	PhotoUrls []string
	Tags      []string
}

PetstorePetUpdateFlags holds the flag values for the PetstorePetUpdate action.

type PetstorePetUpdateFormFlags

type PetstorePetUpdateFormFlags struct {
	Id     int64
	Name   string
	Status PetstorePetUpdateFormStatus
}

PetstorePetUpdateFormFlags holds the flag values for the PetstorePetUpdateForm action.

type PetstorePetUpdateFormStatus

type PetstorePetUpdateFormStatus string

PetstorePetUpdateFormStatus represents the allowed values for the Status flag.

const (
	PetstorePetUpdateFormStatusAvailable PetstorePetUpdateFormStatus = "available"
	PetstorePetUpdateFormStatusPending   PetstorePetUpdateFormStatus = "pending"
	PetstorePetUpdateFormStatusSold      PetstorePetUpdateFormStatus = "sold"
)

func (PetstorePetUpdateFormStatus) IsValid

func (v PetstorePetUpdateFormStatus) IsValid() bool

type PetstorePetUpdateStatus

type PetstorePetUpdateStatus string

PetstorePetUpdateStatus represents the allowed values for the Status flag.

const (
	PetstorePetUpdateStatusAvailable PetstorePetUpdateStatus = "available"
	PetstorePetUpdateStatusPending   PetstorePetUpdateStatus = "pending"
	PetstorePetUpdateStatusSold      PetstorePetUpdateStatus = "sold"
)

func (PetstorePetUpdateStatus) IsValid

func (v PetstorePetUpdateStatus) IsValid() bool

type PetstorePetUploadImageArgs

type PetstorePetUploadImageArgs struct {
	PathToFile string
}

PetstorePetUploadImageArgs holds the positional arguments for the PetstorePetUploadImage action.

type PetstorePetUploadImageFlags

type PetstorePetUploadImageFlags struct {
	Id                 int64
	AdditionalMetadata string
}

PetstorePetUploadImageFlags holds the flag values for the PetstorePetUploadImage action.

type PetstoreStoreOrderDeleteArgs

type PetstoreStoreOrderDeleteArgs struct {
	Id string
}

PetstoreStoreOrderDeleteArgs holds the positional arguments for the PetstoreStoreOrderDelete action.

type PetstoreStoreOrderGetFlags

type PetstoreStoreOrderGetFlags struct {
	Id int64
}

PetstoreStoreOrderGetFlags holds the flag values for the PetstoreStoreOrderGet action.

type PetstoreStoreOrderPlaceArgs

type PetstoreStoreOrderPlaceArgs struct {
	PathToOrderBody string
}

PetstoreStoreOrderPlaceArgs holds the positional arguments for the PetstoreStoreOrderPlace action.

type PetstoreStoreOrderPlaceFlags

type PetstoreStoreOrderPlaceFlags struct {
	PetId    int64
	Quantity int64
	Status   PetstoreStoreOrderPlaceStatus
	Complete bool
}

PetstoreStoreOrderPlaceFlags holds the flag values for the PetstoreStoreOrderPlace action.

type PetstoreStoreOrderPlaceStatus

type PetstoreStoreOrderPlaceStatus string

PetstoreStoreOrderPlaceStatus represents the allowed values for the Status flag.

const (
	PetstoreStoreOrderPlaceStatusPlaced    PetstoreStoreOrderPlaceStatus = "placed"
	PetstoreStoreOrderPlaceStatusApproved  PetstoreStoreOrderPlaceStatus = "approved"
	PetstoreStoreOrderPlaceStatusDelivered PetstoreStoreOrderPlaceStatus = "delivered"
)

func (PetstoreStoreOrderPlaceStatus) IsValid

func (v PetstoreStoreOrderPlaceStatus) IsValid() bool

type PetstoreUserCreateArgs

type PetstoreUserCreateArgs struct {
	PathToUserBody string
}

PetstoreUserCreateArgs holds the positional arguments for the PetstoreUserCreate action.

type PetstoreUserCreateFlags

type PetstoreUserCreateFlags struct {
	Username  string
	FirstName string
	LastName  string
	Email     string
	Password  string
	Phone     string
	Status    int64
}

PetstoreUserCreateFlags holds the flag values for the PetstoreUserCreate action.

type PetstoreUserCreateWithListArgs

type PetstoreUserCreateWithListArgs struct {
	PathToUsersBody string
}

PetstoreUserCreateWithListArgs holds the positional arguments for the PetstoreUserCreateWithList action.

type PetstoreUserDeleteFlags

type PetstoreUserDeleteFlags struct {
	Username string
}

PetstoreUserDeleteFlags holds the flag values for the PetstoreUserDelete action.

type PetstoreUserGetFlags

type PetstoreUserGetFlags struct {
	Username string
}

PetstoreUserGetFlags holds the flag values for the PetstoreUserGet action.

type PetstoreUserLoginFlags

type PetstoreUserLoginFlags struct {
	Username string
	Password string
}

PetstoreUserLoginFlags holds the flag values for the PetstoreUserLogin action.

type PetstoreUserUpdateFlags

type PetstoreUserUpdateFlags struct {
	Username   string
	FirstName  string
	LastName   string
	Email      string
	Password   string
	Phone      string
	UserStatus int64
}

PetstoreUserUpdateFlags holds the flag values for the PetstoreUserUpdate action.

type Terminal

type Terminal interface {
	IsTerminalOutput() bool
	Is256ColorSupported() bool
	IsTrueColorSupported() bool
	Theme() string
	Size() (int, int, error)
}

Terminal provides terminal capability detection.

type UsageFunc

type UsageFunc func() error

UsageFunc is a function that renders the usage for a command.

type ValidationError

type ValidationError struct {
	Message string
}

ValidationError represents an error that occurred during action validation.

func NewValidationError

func NewValidationError(message string) *ValidationError

NewValidationError creates a new ValidationError.

func (ValidationError) Error

func (err ValidationError) Error() string

Jump to

Keyboard shortcuts

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