internal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotEmpty

func NotEmpty[T ~string | ~[]string | ~[][]string](x, y T) (T, bool)

func SetupLogger

func SetupLogger(debug, quiet bool)

func Stderr

func Stderr(quiet bool) io.Writer

Types

type Cmd

type Cmd []string

func NewCmd

func NewCmd(v ...string) Cmd

func (Cmd) Arg

func (c Cmd) Arg(v string) Cmd

func (Cmd) Execute

func (c Cmd) Execute(ctx context.Context, opt ...Option) error

func (Cmd) Len

func (c Cmd) Len() int

type Config

type Config struct {
	StdinReader  *ConfigItem[io.Reader]
	StdoutWriter *ConfigItem[io.Writer]
	StderrWriter *ConfigItem[io.Writer]
	Dir          *ConfigItem[string]
}

func (*Config) Apply

func (s *Config) Apply(opt ...Option)

type ConfigBuilder

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

func NewConfigBuilder

func NewConfigBuilder() *ConfigBuilder

func (*ConfigBuilder) Build

func (s *ConfigBuilder) Build() *Config

func (*ConfigBuilder) Dir

func (s *ConfigBuilder) Dir(v string) *ConfigBuilder

func (*ConfigBuilder) StderrWriter

func (s *ConfigBuilder) StderrWriter(v io.Writer) *ConfigBuilder

func (*ConfigBuilder) StdinReader

func (s *ConfigBuilder) StdinReader(v io.Reader) *ConfigBuilder

func (*ConfigBuilder) StdoutWriter

func (s *ConfigBuilder) StdoutWriter(v io.Writer) *ConfigBuilder

type ConfigItem

type ConfigItem[T any] struct {
	// contains filtered or unexported fields
}

func NewConfigItem

func NewConfigItem[T any](defaultValue T) *ConfigItem[T]

func (*ConfigItem[T]) Default

func (s *ConfigItem[T]) Default() T

func (*ConfigItem[T]) Get

func (s *ConfigItem[T]) Get() T

func (*ConfigItem[T]) IsModified

func (s *ConfigItem[T]) IsModified() bool

func (*ConfigItem[T]) Set

func (s *ConfigItem[T]) Set(value T)

type EmptyLangSpec

type EmptyLangSpec struct{}

func (EmptyLangSpec) ExecCmd

func (EmptyLangSpec) ExecCmd() []string

func (EmptyLangSpec) InitCmd

func (EmptyLangSpec) InitCmd(_ string) [][]string

func (EmptyLangSpec) Main

func (EmptyLangSpec) Main() string

func (EmptyLangSpec) Template

func (EmptyLangSpec) Template() Template

type EmptyTemplate

type EmptyTemplate struct{}

func NewEmptyTemplate

func NewEmptyTemplate() *EmptyTemplate

func (EmptyTemplate) Execute

func (EmptyTemplate) Execute(_ io.Writer, _ *TemplateArgs) error

type GoLangSpec

type GoLangSpec struct{}

func (GoLangSpec) ExecCmd

func (GoLangSpec) ExecCmd() []string

func (GoLangSpec) InitCmd

func (GoLangSpec) InitCmd(dir string) [][]string

func (GoLangSpec) Main

func (GoLangSpec) Main() string

func (GoLangSpec) Template

func (GoLangSpec) Template() Template

type Lang

type Lang int
const (
	Lunknown Lang = iota
	Lgo
	Lpython
	LpythonPipenv
	Lrust
)

func NewLang

func NewLang(s string) Lang

func (Lang) Spec

func (la Lang) Spec() LangSpec

func (Lang) String

func (i Lang) String() string

type LangSpec

type LangSpec interface {
	Main() string
	InitCmd(dir string) [][]string
	ExecCmd() []string
	Template() Template
}

type Option

type Option func(*Config)

func WithDir

func WithDir(v string) Option

func WithStderrWriter

func WithStderrWriter(v io.Writer) Option

func WithStdinReader

func WithStdinReader(v io.Reader) Option

func WithStdoutWriter

func WithStdoutWriter(v io.Writer) Option

type OtherTemplate

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

func ParseTemplateStringOrFile

func ParseTemplateStringOrFile(s string) (*OtherTemplate, error)

func (OtherTemplate) Execute

func (t OtherTemplate) Execute(w io.Writer, data *TemplateArgs) error

type PythonLangSpec

type PythonLangSpec struct{}

func (PythonLangSpec) ExecCmd

func (PythonLangSpec) ExecCmd() []string

func (PythonLangSpec) InitCmd

func (PythonLangSpec) InitCmd(_ string) [][]string

func (PythonLangSpec) Main

func (PythonLangSpec) Main() string

func (PythonLangSpec) Template

func (PythonLangSpec) Template() Template

type PythonPipenvLangSpec

type PythonPipenvLangSpec struct {
	PythonLangSpec
}

func (PythonPipenvLangSpec) ExecCmd

func (PythonPipenvLangSpec) ExecCmd() []string

func (PythonPipenvLangSpec) InitCmd

func (PythonPipenvLangSpec) InitCmd(_ string) [][]string

type RustLangSpec

type RustLangSpec struct{}

func (RustLangSpec) ExecCmd

func (RustLangSpec) ExecCmd() []string

func (RustLangSpec) InitCmd

func (s RustLangSpec) InitCmd(_ string) [][]string

func (RustLangSpec) Main

func (RustLangSpec) Main() string

func (RustLangSpec) Template

func (RustLangSpec) Template() Template

type Template

type Template interface {
	Execute(w io.Writer, data *TemplateArgs) error
}

func NewGoTemplate

func NewGoTemplate() Template

func NewPythonTemplate

func NewPythonTemplate() Template

func NewRustTemplate

func NewRustTemplate() Template

type TemplateArgs

type TemplateArgs struct {
	Init    string
	Map     string
	Reduce  string
	Imports []string
}

Jump to

Keyboard shortcuts

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