compiler

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByConfigPropertyKey

type ByConfigPropertyKey []ConfigProperty

ByConfigPropertyKey can be used to sort an array of ConfigProperties by their keys

func (ByConfigPropertyKey) Len

func (s ByConfigPropertyKey) Len() int

func (ByConfigPropertyKey) Less

func (s ByConfigPropertyKey) Less(i, j int) bool

func (ByConfigPropertyKey) Swap

func (s ByConfigPropertyKey) Swap(i, j int)

type Compiler

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

Compiler is responsible for transforming ExpandingHostConfigs into an array of HostEntities.

func NewCompiler

func NewCompiler() *Compiler

NewCompiler creates an instance of Compiler

func (*Compiler) Compile

func (c *Compiler) Compile(input ExpandingHostConfig) ([]HostEntity, error)

Compile converts a single ExpandingHostConfig into list of HostEntities

func (*Compiler) CompileRegexp added in v0.3.0

func (c *Compiler) CompileRegexp(input ExpandingHostConfig, hosts InputHosts) ([]HostEntity, error)

CompileRegexp compiles regexp ExpandingHostConfig against provided InputHosts

type ConfigProperties

type ConfigProperties []ConfigProperty

ConfigProperties is a list of ssh config properties

type ConfigProperty

type ConfigProperty struct {
	Key   string
	Value interface{}
}

ConfigProperty is a key-value container

type ContextSource added in v0.1.2

type ContextSource struct {
	SourceName string
	Hosts      []ExpandingHostConfig
}

ContextSource represents a single piece of source that provides host and configs definitions

type ExpandingHostConfig

type ExpandingHostConfig struct {
	AliasName       string
	HostnamePattern string
	AliasTemplate   string
	Config          ConfigProperties
}

ExpandingHostConfig is the input for the ssh-aliases compiler

func (*ExpandingHostConfig) IsRegexpHostDefinition added in v0.3.0

func (e *ExpandingHostConfig) IsRegexpHostDefinition() bool

IsRegexpHostDefinition checks if the specified host definition should be compiled as a regexp against provided hosts input file

type HostEntity

type HostEntity struct {
	Host     string
	HostName string
	Config   ConfigProperties
}

HostEntity is the outcome of ssh-alises compiler

type InputContext added in v0.1.2

type InputContext struct {
	Sources []ContextSource
}

InputContext is the container for all host and configs

type InputHosts added in v0.3.0

type InputHosts []string

InputHosts is a list of hosts that can be used by the compiler to process RegexpHostConfig

type Validator

type Validator struct{}

Validator can be used to check the consistency of generated HostEntities

func NewValidator

func NewValidator() *Validator

NewValidator creates an instance of Validator

func (*Validator) ValidateResults

func (v *Validator) ValidateResults(results []HostEntity) error

ValidateResults checks if generated HostEntities have unique alias names

Jump to

Keyboard shortcuts

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