cli

package
v0.0.0-...-a36ccc7 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitCodeOk                = 0
	ExitCodeInternalCliError  = 1
	ExitCodeBadUserInputError = 2
)

Variables

This section is empty.

Functions

func New

func New(impl CLIHandlersInterface, version string) *urfavecli.Command

Types

type CLIHandlersInterface

type CLIHandlersInterface interface {

	// OcliGenerateCli handles the invocation of:
	//
	// “`sh
	// ocli generate cli [flags]
	// “`
	OcliGenerateCli(ctx context.Context, cmd *urfavecli.Command, flags OcliGenerateCliFlags) error

	// OcliGenerateDocs handles the invocation of:
	//
	// “`sh
	// ocli generate docs [flags]
	// “`
	OcliGenerateDocs(ctx context.Context, cmd *urfavecli.Command, flags OcliGenerateDocsFlags) error

	// OcliSpecificationCheck handles the invocation of:
	//
	// “`sh
	// ocli specification check <path-to-spec>
	// “`
	OcliSpecificationCheck(ctx context.Context, cmd *urfavecli.Command, arguments OcliSpecificationCheckArgs) error

	// OcliSpecificationVersions handles the invocation of:
	//
	// “`sh
	// ocli specification versions
	// “`
	OcliSpecificationVersions(ctx context.Context, cmd *urfavecli.Command) error
}

CLIHandlersInterface represents the handlers required to implement all commands of the CLI. An implementation of this interface will be injected into the generated CLI wrapper code.

type Impl

type Impl struct{}

func (Impl) OcliGenerateCli

func (Impl) OcliGenerateCli(ctx context.Context, c *urfavecli.Command, flags OcliGenerateCliFlags) error

func (Impl) OcliGenerateDocs

func (Impl) OcliGenerateDocs(ctx context.Context, c *urfavecli.Command, flags OcliGenerateDocsFlags) error

func (Impl) OcliSpecificationCheck

func (Impl) OcliSpecificationCheck(ctx context.Context, c *urfavecli.Command, args OcliSpecificationCheckArgs) error

func (Impl) OcliSpecificationVersions

func (Impl) OcliSpecificationVersions(ctx context.Context, c *urfavecli.Command) error

type OcliGenerateCliFlags

type OcliGenerateCliFlags struct {
	SpecFile   string
	OutputDir  string
	Framework  string
	GoPackage  string
	ModuleType string
	Dryrun     bool
}

OcliGenerateCliFlags holds the parsed flags that will be injected into the command handler implementation.

type OcliGenerateDocsFlags

type OcliGenerateDocsFlags struct {
	SpecFile  string
	OutputDir string
	Format    string
	Footer    bool
	Dryrun    bool
}

OcliGenerateDocsFlags holds the parsed flags that will be injected into the command handler implementation.

type OcliSpecificationCheckArgs

type OcliSpecificationCheckArgs struct {
	PathToSpec string
}

OcliSpecificationCheckArgs holds the parsed arguments that will be injected into the command handler implementation.

Jump to

Keyboard shortcuts

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