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.
Index ¶
- Constants
- func DefaultHelpFunc(a ActionsInterface, cmd *spec.CommandItem)
- func DefaultUsageFunc(a ActionsInterface, cmd *spec.CommandItem) error
- func NewCmdOcli(a ActionsInterface) *cobra.Command
- func NewCmdOcliCheck(a ActionsInterface) *cobra.Command
- func NewCmdOcliGen(a ActionsInterface) *cobra.Command
- func NewCmdOcliGenCli(a ActionsInterface) *cobra.Command
- func NewCmdOcliGenDocs(a ActionsInterface) *cobra.Command
- func Run(ctx context.Context, actions ActionsInterface) int
- type ActionsInterface
- type CLIError
- type DefaultIOStreams
- type DefaultTerminal
- type FileReader
- type FileWriter
- type IOStreams
- type OcliCheckArgs
- type OcliCheckFlags
- type OcliGenCliArgs
- type OcliGenCliFlags
- type OcliGenCliFramework
- type OcliGenDocsArgs
- type OcliGenDocsFlags
- type OcliGenDocsFormat
- type Terminal
- type UsageFunc
- type ValidationError
Constants ¶
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 NewCmdOcli ¶
func NewCmdOcli(a ActionsInterface) *cobra.Command
func NewCmdOcliCheck ¶
func NewCmdOcliCheck(a ActionsInterface) *cobra.Command
func NewCmdOcliGen ¶
func NewCmdOcliGen(a ActionsInterface) *cobra.Command
func NewCmdOcliGenCli ¶
func NewCmdOcliGenCli(a ActionsInterface) *cobra.Command
func NewCmdOcliGenDocs ¶
func NewCmdOcliGenDocs(a ActionsInterface) *cobra.Command
Types ¶
type ActionsInterface ¶
type ActionsInterface interface {
OcliCheck(ctx context.Context, args OcliCheckArgs, flags OcliCheckFlags) error
OcliGenDocs(ctx context.Context, args OcliGenDocsArgs, flags OcliGenDocsFlags) error
OcliGenCli(ctx context.Context, args OcliGenCliArgs, flags OcliGenCliFlags) error
HelpFunc(cmd *spec.CommandItem)
UsageFunc(cmd *spec.CommandItem) error
IOStreams() IOStreams
Version() string
}
ActionsInterface defines all actions the ocli CLI supports.
type CLIError ¶
CLIError represents a CLI error with an exit code and an optional usage function.
func BadUserInput ¶
BadUserInput creates a new CLIError with the bad user input exit code.
func InternalError ¶
InternalError creates a new CLIError with the internal error exit code.
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) 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 ¶
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.
type OcliCheckArgs ¶
type OcliCheckArgs struct {
PathToSpec string
}
OcliCheckArgs holds the positional arguments for the OcliCheck action.
type OcliCheckFlags ¶
type OcliCheckFlags struct {
FailOnErr bool
}
OcliCheckFlags holds the flag values for the OcliCheck action.
type OcliGenCliArgs ¶
type OcliGenCliArgs struct {
PathToSpec string
}
OcliGenCliArgs holds the positional arguments for the OcliGenCli action.
type OcliGenCliFlags ¶
type OcliGenCliFlags struct {
Out string
Framework OcliGenCliFramework
}
OcliGenCliFlags holds the flag values for the OcliGenCli action.
type OcliGenCliFramework ¶
type OcliGenCliFramework string
OcliGenCliFramework represents the allowed values for the Framework flag.
const ( OcliGenCliFrameworkCobra OcliGenCliFramework = "cobra" OcliGenCliFrameworkUrfavecli OcliGenCliFramework = "urfavecli" OcliGenCliFrameworkYargs OcliGenCliFramework = "yargs" )
func (OcliGenCliFramework) IsValid ¶
func (v OcliGenCliFramework) IsValid() bool
type OcliGenDocsArgs ¶
type OcliGenDocsArgs struct {
PathToSpec string
}
OcliGenDocsArgs holds the positional arguments for the OcliGenDocs action.
type OcliGenDocsFlags ¶
type OcliGenDocsFlags struct {
Format OcliGenDocsFormat
Out string
NoBadge bool
}
OcliGenDocsFlags holds the flag values for the OcliGenDocs action.
type OcliGenDocsFormat ¶
type OcliGenDocsFormat string
OcliGenDocsFormat represents the allowed values for the Format flag.
const ( OcliGenDocsFormatMarkdown OcliGenDocsFormat = "markdown" OcliGenDocsFormatHtmlPage OcliGenDocsFormat = "html-page" OcliGenDocsFormatHtmlEmbed OcliGenDocsFormat = "html-embed" OcliGenDocsFormatMan OcliGenDocsFormat = "man" )
func (OcliGenDocsFormat) IsValid ¶
func (v OcliGenDocsFormat) IsValid() bool
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