essh

package
v3.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegistryTypeGlobal = 0
	RegistryTypeLocal  = 1
)
View Source
const (
	TASK_BACKEND_LOCAL  = "local"
	TASK_BACKEND_REMOTE = "remote"
)
View Source
const EnvironmentTemplate = `` /* 961-byte string literal not displayed */
View Source
const (
	ExitErr = 1
)
View Source
const FunctionsTemplate = `` /* 157-byte string literal not displayed */
View Source
const LDriverClass = "Driver*"
View Source
const LGroupClass = "Group*"
View Source
const LHostClass = "Host*"
View Source
const LHostQueryClass = "HostQuery*"
View Source
const LRegistryClass = "Registry*"
View Source
const LTaskClass = "Task*"

Variables

View Source
var (
	UserConfigFile               string
	UserOverrideConfigFile       string
	UserDataDir                  string
	WorkingDirConfigFile         string
	WorkingDirOverrideConfigFile string
	WorkingDataDir               string
	WorkingDir                   string
	Executable                   string
)

system configurations.

View Source
var (
	DefaultPrefixLocal  = `[local:{{.Host.Name}}]{{HostnameAlignString " "}}`
	DefaultPrefixRemote = `[remote:{{.Host.Name}}]{{HostnameAlignString " "}}`
)
View Source
var (
	CommitHash string = "unknown"
	Version    string = "dev"
)
View Source
var ALIASES_CODE = `` /* 289-byte string literal not displayed */
View Source
var BASH_COMPLETION = `` /* 4339-byte string literal not displayed */
View Source
var DefaultDriverName = "default"
View Source
var DefaultTaskName = "default"
View Source
var Drivers map[string]*Driver
View Source
var Hosts map[string]*Host
View Source
var (
	SSHConfigFlag bool
)

flags

View Source
var Tasks map[string]*Task
View Source
var ZSH_COMPLETION = `` /* 7117-byte string literal not displayed */

Functions

func ColonEscape added in v0.24.0

func ColonEscape(s string) string

func EnvKeyEscape added in v0.17.0

func EnvKeyEscape(s string) string

func GenHostsConfig

func GenHostsConfig(enabledHosts []*Host) ([]byte, error)

func GetContentFromPath added in v0.25.0

func GetContentFromPath(shellPath string) ([]byte, error)

func GetTags added in v0.71.0

func GetTags(hosts map[string]*Host) []string

func HostnameAlignString added in v0.49.0

func HostnameAlignString(host *Host, hosts []*Host) func(string) string

func InitLuaState

func InitLuaState(L *lua.LState)

func Run added in v0.65.0

func Run(osArgs []string) (exitStatus int)

func ShellEscape added in v0.12.0

func ShellEscape(s string) string

func UpdateSSHConfig added in v0.24.0

func UpdateSSHConfig(outputConfig string, enabledHosts []*Host) ([]byte, error)

Types

type CallbackWriter added in v0.12.0

type CallbackWriter struct {
	Func func(data []byte)
}

func (*CallbackWriter) Write added in v0.12.0

func (w *CallbackWriter) Write(data []byte) (int, error)

type Driver added in v0.25.0

type Driver struct {
	Name     string
	Props    map[string]interface{}
	Engine   func(*Driver) (string, error)
	Registry *Registry
	Group    *Group
	LValues  map[string]lua.LValue
	Parent   *Driver
	Child    *Driver
}
var DefaultDriver *Driver

func NewDriver added in v0.25.0

func NewDriver() *Driver

func (*Driver) GenerateRunnableContent added in v0.25.0

func (driver *Driver) GenerateRunnableContent(sshConfigPath string, task *Task, host *Host) (string, error)

func (*Driver) MapLValuesToLTable added in v0.71.0

func (driver *Driver) MapLValuesToLTable(tb *lua.LTable)

type Group added in v0.85.0

type Group struct {
	Type    GroupType
	Hosts   map[string]*Host
	Tasks   map[string]*Task
	Drivers map[string]*Driver
	LValues map[string]lua.LValue
}

func NewGroup added in v0.85.0

func NewGroup() *Group

func (*Group) RegisterDriver added in v0.85.0

func (group *Group) RegisterDriver(driver *Driver)

func (*Group) RegisterHost added in v0.85.0

func (group *Group) RegisterHost(host *Host)

func (*Group) RegisterTask added in v0.85.0

func (group *Group) RegisterTask(task *Task)

type GroupType added in v0.85.0

type GroupType int
const (
	GroupTypeUndefined GroupType = iota
	GroupTypeHosts
	GroupTypeTasks
	GroupTypeDrivers
)

type Host

type Host struct {
	Name                 string
	Description          string
	Props                map[string]string
	HooksBeforeConnect   []interface{}
	HooksAfterConnect    []interface{}
	HooksAfterDisconnect []interface{}
	Hidden               bool
	Tags                 []string
	SSHConfig            map[string]string
	Registry             *Registry
	Group                *Group
	LValues              map[string]lua.LValue
	// If you define same name hosts in multi time, stores it in layered structure that uses Parent and Child.
	Parent *Host
	Child  *Host
}

func NewHost added in v0.50.0

func NewHost() *Host

func (*Host) DescriptionOrDefault added in v0.31.0

func (h *Host) DescriptionOrDefault() string

func (*Host) MapLValuesToLTable added in v0.71.0

func (h *Host) MapLValuesToLTable(tb *lua.LTable)

func (*Host) SortedSSHConfig added in v0.43.0

func (h *Host) SortedSSHConfig() []map[string]string

type HostQuery added in v0.52.0

type HostQuery struct {
	Datasource map[string]*Host
	Selections []string
	Filters    []string
	Hidden     *bool
}

func NewHostQuery added in v0.52.0

func NewHostQuery() *HostQuery

func (*HostQuery) AppendFilter added in v0.55.0

func (hostQuery *HostQuery) AppendFilter(filter string) *HostQuery

func (*HostQuery) AppendFilters added in v0.60.0

func (hostQuery *HostQuery) AppendFilters(filters []string) *HostQuery

func (*HostQuery) AppendSelection added in v0.60.0

func (hostQuery *HostQuery) AppendSelection(selection string) *HostQuery

func (*HostQuery) AppendSelections added in v0.60.0

func (hostQuery *HostQuery) AppendSelections(selections []string) *HostQuery

func (*HostQuery) GetHosts added in v0.52.0

func (hostQuery *HostQuery) GetHosts() []*Host

func (*HostQuery) GetHostsOrderByName added in v0.60.0

func (hostQuery *HostQuery) GetHostsOrderByName() []*Host

func (*HostQuery) SetDatasource added in v0.68.0

func (hostQuery *HostQuery) SetDatasource(datasource map[string]*Host) *HostQuery

type NameSortableHosts added in v0.60.0

type NameSortableHosts []*Host

func (NameSortableHosts) Len added in v0.60.0

func (h NameSortableHosts) Len() int

func (NameSortableHosts) Less added in v0.60.0

func (h NameSortableHosts) Less(i, j int) bool

func (NameSortableHosts) Swap added in v0.60.0

func (h NameSortableHosts) Swap(i, j int)

type NameSortableTasks added in v0.68.0

type NameSortableTasks []*Task

func (NameSortableTasks) Len added in v0.68.0

func (t NameSortableTasks) Len() int

func (NameSortableTasks) Less added in v0.68.0

func (t NameSortableTasks) Less(i, j int) bool

func (NameSortableTasks) Swap added in v0.68.0

func (t NameSortableTasks) Swap(i, j int)

type Registry added in v0.44.0

type Registry struct {
	Key  string
	Type int
}
var CurrentRegistry *Registry
var GlobalRegistry *Registry
var LocalRegistry *Registry

func NewRegistry added in v0.44.0

func NewRegistry(dataDir string, registryType int) *Registry

func (*Registry) TypeString added in v0.44.0

func (reg *Registry) TypeString() string

type Task added in v0.12.0

type Task struct {
	Name        string
	Description string
	Props       map[string]string
	Prepare     func() error
	Driver      string
	Pty         bool
	Script      []map[string]string
	File        string
	Backend     string
	Targets     []string
	Filters     []string
	Parallel    bool
	Privileged  bool
	User        string
	SSHOptions  []string
	// deprecated? use only hidden?
	Disabled  bool
	Hidden    bool
	Prefix    string
	UsePrefix bool
	Registry  *Registry
	Group     *Group
	Args      []string
	LValues   map[string]lua.LValue
	Parent    *Task
	Child     *Task
}

func GetEnabledTask added in v0.35.0

func GetEnabledTask(name string) *Task

func NewTask added in v0.16.0

func NewTask() *Task

func (*Task) DescriptionOrDefault added in v0.31.0

func (t *Task) DescriptionOrDefault() string

func (*Task) FiltersSlice added in v0.60.0

func (t *Task) FiltersSlice() []string

func (*Task) IsRemoteTask added in v0.16.0

func (t *Task) IsRemoteTask() bool

func (*Task) MapLValuesToLTable added in v0.71.0

func (t *Task) MapLValuesToLTable(tb *lua.LTable)

func (*Task) PublicName added in v0.68.0

func (t *Task) PublicName() string

func (*Task) TargetsSlice added in v0.35.0

func (t *Task) TargetsSlice() []string

type TaskQuery added in v0.68.0

type TaskQuery struct {
	Datasource map[string]*Task
}

func NewTaskQuery added in v0.68.0

func NewTaskQuery() *TaskQuery

func (*TaskQuery) GetTasks added in v0.68.0

func (taskQuery *TaskQuery) GetTasks() []*Task

func (*TaskQuery) GetTasksOrderByName added in v0.68.0

func (taskQuery *TaskQuery) GetTasksOrderByName() []*Task

func (*TaskQuery) SetDatasource added in v0.68.0

func (taskQuery *TaskQuery) SetDatasource(datasource map[string]*Task) *TaskQuery

Jump to

Keyboard shortcuts

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