cmd

package
v1.199.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 18 Imported by: 40

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLocation = errors.New("invalid location: (format kind:location)")

ErrInvalidLocation for cmd.

View Source
var ErrLocationMissing = errors.New("location is missing")

ErrLocationMissing for cmd.

View Source
var InputFlag = flags.String()

InputFlag for cmd.

Module for fx.

View Source
var OutputFlag = flags.String()

OutputFlag for cmd.

Functions

func RunClient added in v1.39.0

func RunClient(ctx context.Context, name string, opts ...fx.Option) error

RunClient is a short lived process.

func RunServer

func RunServer(ctx context.Context, name string, opts ...fx.Option) error

RunServer is a long running process.

func SplitFlag added in v1.172.5

func SplitFlag(flag string) (string, string)

SplitFlag for cmd.

func Start added in v1.198.0

func Start(lc fx.Lifecycle, fn StartFn)

Start for cmd.

Types

type Command added in v1.39.0

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

Command for application.

func New

func New(version string) *Command

New command.

func (*Command) AddClient added in v1.39.0

func (c *Command) AddClient(opts ...fx.Option) *cobra.Command

AddClient to the command.

func (*Command) AddClientCommand added in v1.56.2

func (c *Command) AddClientCommand(name, description string, opts ...fx.Option) *cobra.Command

AddClientCommand to root.

func (*Command) AddServer added in v1.39.0

func (c *Command) AddServer(opts ...fx.Option) *cobra.Command

AddServer to the command.

func (*Command) AddServerCommand added in v1.56.2

func (c *Command) AddServerCommand(name, description string, opts ...fx.Option) *cobra.Command

AddServerCommand to root.

func (*Command) RegisterInput added in v1.187.0

func (c *Command) RegisterInput(value string)

RegisterInput for cmd.

func (*Command) RegisterOutput added in v1.187.0

func (c *Command) RegisterOutput(value string)

RegisterInput for cmd.

func (*Command) Run added in v1.39.0

func (c *Command) Run() error

Run the command.

func (*Command) RunWithArgs added in v1.78.0

func (c *Command) RunWithArgs(args []string) error

Run the command with a an arg.

type Config added in v1.78.0

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

Config for cmd.

func NewConfig added in v1.78.0

func NewConfig(flag string, mm *marshaller.Map) *Config

NewConfig for cmd.

func (*Config) Kind added in v1.138.5

func (c *Config) Kind() string

Kind of config.

func (*Config) Unmarshal added in v1.81.0

func (c *Config) Unmarshal(data any) error

Unmarshal for config.

func (*Config) Write added in v1.81.0

func (c *Config) Write(data []byte, mode fs.FileMode) error

Write for config.

type ENV added in v1.81.0

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

ENV for cmd.

func NewENV added in v1.81.0

func NewENV(location string) *ENV

NewENV for cmd.

func (*ENV) Kind added in v1.81.0

func (e *ENV) Kind() string

Kind for env.

func (*ENV) Read added in v1.81.0

func (e *ENV) Read() ([]byte, error)

Read for env.

func (*ENV) Write added in v1.81.0

func (e *ENV) Write(data []byte, mode fs.FileMode) error

Write for env.

type File added in v1.81.0

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

File for cmd.

func NewFile added in v1.81.0

func NewFile(location string) *File

NewFile for cmd.

func (*File) Kind added in v1.81.0

func (f *File) Kind() string

Kind for file.

func (*File) Read added in v1.81.0

func (f *File) Read() ([]byte, error)

Read for file.

func (*File) Write added in v1.81.0

func (f *File) Write(data []byte, mode fs.FileMode) error

Write for file.

type InputConfig added in v1.81.0

type InputConfig struct {
	*Config
}

InputConfig for cmd.

func NewInputConfig added in v1.81.0

func NewInputConfig(mm *marshaller.Map) *InputConfig

NewInputConfig for cmd.

type None added in v1.188.0

type None struct{}

None for cmd.

func NewNone added in v1.188.0

func NewNone() *None

NewNone for cmd.

func (*None) Kind added in v1.188.0

func (*None) Kind() string

Kind for none.

func (*None) Read added in v1.188.0

func (*None) Read() ([]byte, error)

Read for none.

func (*None) Write added in v1.188.0

func (*None) Write(_ []byte, _ fs.FileMode) error

Write for none.

type OutputConfig added in v1.181.0

type OutputConfig struct {
	*Config
}

OutputConfig for cmd.

func NewOutputConfig added in v1.181.0

func NewOutputConfig(mm *marshaller.Map) *OutputConfig

NewOutputConfig for cmd.

type ReaderWriter added in v1.81.0

type ReaderWriter interface {
	// Read bytes.
	Read() ([]byte, error)

	// Write bytes with files's mode.
	Write(data []byte, mode fs.FileMode) error

	// Kind of read writer.
	Kind() string
}

ReaderWriter for cmd.

func NewReadWriter added in v1.172.5

func NewReadWriter(kind, location string) ReaderWriter

NewReadWriter for cmd.

type StartFn added in v1.198.0

type StartFn func(ctx context.Context)

StartFn for cmd.

Jump to

Keyboard shortcuts

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