commands

package
v0.0.0-...-5afa41d Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the build version eg: v1.0.0
	Version string
	// MinVersion is the latest commit hash on building
	MinVersion string
	// BuildTime is the unix timestamp when the build was done
	BuildTime string
)

Functions

This section is empty.

Types

type CodeGenerator

type CodeGenerator struct {
	*CommandWriter

	fs.FS
	// contains filtered or unexported fields
}

CodeGenerator will act as a base class for all code generator commands

func NewCodeGenerator

func NewCodeGenerator(writer *CommandWriter) *CodeGenerator

NewCodeGenerator return a new instance of CodeGenerator

func (*CodeGenerator) GetDefenitionsAndTypes

func (c *CodeGenerator) GetDefenitionsAndTypes() (*parser.Definition, *types.TypeDefs, error)

GetDefenitionsAndTypes will parse given config and return definitions and typedefs

func (*CodeGenerator) Help

func (c *CodeGenerator) Help()

Help prints the help message

func (*CodeGenerator) InitFlags

func (c *CodeGenerator) InitFlags()

InitFlags will initialize all flags

func (*CodeGenerator) ParseFlags

func (c *CodeGenerator) ParseFlags(args []string)

ParseFlags will parse given flags

func (*CodeGenerator) Setup

func (c *CodeGenerator) Setup() bool

Setup will setup log levels and help command

type Command

type Command interface {
	InitFlags()
	ParseFlags([]string)
	Help()
	Exec() error
}

Command is the interface implemented by types

func GetCmd

func GetCmd(args []string) Command

GetCmd will get command by flags

type CommandWriter

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

CommandWriter can be used to write help texts to stdout/tcp or any given writer interface

func NewCommandWriter

func NewCommandWriter(writer io.Writer) *CommandWriter

NewCommandWriter returns an instance of CommandWriter

func (*CommandWriter) Write

func (c *CommandWriter) Write(msg ...string) error

Write writes given string to the registered writer interface

type Help

type Help struct {
	*CommandWriter
}

Help is the help command

func NewHelp

func NewHelp(writer *CommandWriter) *Help

NewHelp returns a new instalce of Help

func (Help) Exec

func (h Help) Exec() error

Exec will print help text for envparser

func (Help) Help

func (h Help) Help()

Help prints help text for the command, not needed here

func (Help) InitFlags

func (Help) InitFlags()

InitFlags initialises the flags if any

func (Help) ParseFlags

func (Help) ParseFlags(args []string)

ParseFlags will parse given flags

type Relay

type Relay struct {
	*CodeGenerator
}

Relay is the command doing code generation

func NewRelay

func NewRelay(writer *CommandWriter) *Relay

NewRelay return a new instance of Relay

func (*Relay) Exec

func (c *Relay) Exec() error

Exec will execute the core command functionality, here it Relays and saves the code

func (*Relay) Help

func (c *Relay) Help()

Help prints the help message

type Server

type Server struct {
	*CodeGenerator
}

Server is the command doing code generation

func NewServer

func NewServer(writer *CommandWriter) *Server

NewServer return a new instance of Server

func (*Server) Exec

func (c *Server) Exec() error

Exec will execute the code generation for all given generators based on given configs

func (*Server) Help

func (c *Server) Help()

Help prints the help message

type VersionCmd

type VersionCmd struct {
	*CommandWriter
}

VersionCmd is the VersionCmd command

func NewVersionCmd

func NewVersionCmd(writer *CommandWriter) *VersionCmd

NewVersionCmd returns a new instalce of VersionCmd

func (VersionCmd) Exec

func (v VersionCmd) Exec() error

Exec will print the build versionCmd details

func (VersionCmd) Help

func (v VersionCmd) Help()

Help prints VersionCmd text for the command, not needed here

func (VersionCmd) InitFlags

func (VersionCmd) InitFlags()

InitFlags initialises the flags if any

func (VersionCmd) ParseFlags

func (VersionCmd) ParseFlags(args []string)

ParseFlags will parse given flags

Jump to

Keyboard shortcuts

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