zsh

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGeneratingTemplate = errors.New("failed to execute template")
View Source
var ErrWrongArgumentsProvided = errors.New("number of arguments is invalid")

Functions

func Exec

func Exec(cfg *Config, args []string) (err error)

Types

type CompletionsSpec

type CompletionsSpec struct {
	CLI     map[string]string `yaml:"cli,omitempty"`
	Command map[string]string `yaml:"command,omitempty"`
}

type CompletionsTmplData

type CompletionsTmplData struct {
	FileHeader      FileHeaderTmplData
	Header          string
	CONFIGFILE      string
	COMPLETIONS_DIR string
	Completions     CompletionsSpec
}

func (CompletionsTmplData) Render

func (t CompletionsTmplData) Render() (s string, err error)

type Config

type Config struct {
	*plugins.Context `yaml:"-"`
	Vars             map[string]string `yaml:"vars,omitempty"`
	Exports          map[string]string `yaml:"exports,omitempty"`
	Aliases          map[string]string `yaml:"aliases,omitempty"`
	Completions      CompletionsSpec   `yaml:"completions,omitempty"`
}

func CreateConfig

func CreateConfig() *Config

func ReadConfigFile

func ReadConfigFile(r io.Reader) (f *Config, err error)

func (*Config) DeepEqual

func (c *Config) DeepEqual(other *Config) bool

func (*Config) TemplateConfigs

func (c *Config) TemplateConfigs() (cfgs map[string]interface{})

type Export

type Export struct {
	Key   string
	Value Resolvable
}

type FileHeaderTmplData

type FileHeaderTmplData struct {
	CONFIGFILE string
}

type Generator

type Generator interface {
	Completions(w io.Writer) (err error)
	Exports(w io.Writer) (err error)
}

func NewGenerator

func NewGenerator(opts ...Option) Generator

type GeneratorConfig

type GeneratorConfig struct {
	HttpClient      *http.Client
	Templates       *template.Template
	TemplateConfigs map[string]interface{}
	Context         *plugins.Context
}

type Option

type Option func(*GeneratorConfig) *GeneratorConfig

type Resolvable

type Resolvable interface {
	Name() string
	IsResolved() bool
	Unresolved() (unresolved []string)
	Resolve(ctx *ResolveContext) (ok bool)
}

type ResolveContext

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

func NewContext

func NewContext(context context.Context) (ctx *ResolveContext)

func (*ResolveContext) Add

func (c *ResolveContext) Add(resolvables ...resolvable)

func (ResolveContext) Env

func (c ResolveContext) Env() (env map[string]string)

func (*ResolveContext) Get

func (c *ResolveContext) Get(key string) (val string, ok bool)

func (*ResolveContext) LoadEnvironmentVariables

func (c *ResolveContext) LoadEnvironmentVariables()

func (ResolveContext) ProjectEnv

func (c ResolveContext) ProjectEnv() (env parse.Env)

type ZSH

type ZSH struct {
	Config    *Config
	Generator Generator
	// contains filtered or unexported fields
}

func NewZSH

func NewZSH(cfg *Config) *ZSH

Jump to

Keyboard shortcuts

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