dbot

package module
v0.0.0-...-1b63a33 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

README

dbot

dbot is a simple and useful utility for running commands on multiply computers

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStandradOut

func GetStandradOut(s string) string

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(path string) bool

func SplitCommand

func SplitCommand(str string) []string

Types

type Command

type Command struct {
	Tag   string
	Exec  string
	On    string
	Stdin []string
	Env   Env
	Args  Env
	File  string
}

type Context

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

func NewContext

func NewContext(file string, jobName string) *Context

NewContext create the root context

func (*Context) Clone

func (p *Context) Clone(format string, a ...interface{}) *Context

func (*Context) GetUserInput

func (p *Context) GetUserInput(desc string, mode string) (string, bool)

func (*Context) Log

func (p *Context) Log(outStr string, errStr string)

func (*Context) LogError

func (p *Context) LogError(format string, a ...interface{})

func (*Context) LogInfo

func (p *Context) LogInfo(format string, a ...interface{})

func (*Context) Run

func (p *Context) Run() bool

type DbotObject

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

func (*DbotObject) Command

func (p *DbotObject) Command(call otto.FunctionCall) otto.Value

func (*DbotObject) LogError

func (p *DbotObject) LogError(call otto.FunctionCall) otto.Value

func (*DbotObject) LogInfo

func (p *DbotObject) LogInfo(call otto.FunctionCall) otto.Value

type Env

type Env map[string]string

func (Env) Merge

func (p Env) Merge(env Env) Env

func (Env) ParseEnv

func (p Env) ParseEnv(env Env) Env

func (Env) ParseString

func (p Env) ParseString(v string, defaultStr string, trimSpace bool) string

func (Env) ParseStringArray

func (p Env) ParseStringArray(arr []string) []string

type Import

type Import struct {
	Name string
	File string
	Env  Env
}

type Input

type Input struct {
	Type string
	Desc string
}

type Job

type Job struct {
	Async    bool
	Imports  map[string]*Import
	Remotes  map[string][]*Remote
	Inputs   map[string]*Input
	Env      Env
	Commands []*Command
}

type LocalRunner

type LocalRunner struct {
	sync.Mutex
}

func (*LocalRunner) Name

func (p *LocalRunner) Name() string

func (*LocalRunner) Run

func (p *LocalRunner) Run(ctx *Context) bool

type Remote

type Remote struct {
	Port string
	User string
	Host string
}

type Runner

type Runner interface {
	Name() string
	Run(ctx *Context) bool
}

type RunnerInput

type RunnerInput struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewRunnerInput

func NewRunnerInput(inputs []string, stdin io.Reader) *RunnerInput

func (*RunnerInput) Read

func (p *RunnerInput) Read(b []byte) (n int, err error)

type SSHRunner

type SSHRunner struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSSHRunner

func NewSSHRunner(
	ctx *Context,
	port string,
	user string,
	host string,
) *SSHRunner

func (*SSHRunner) Name

func (p *SSHRunner) Name() string

func (*SSHRunner) Run

func (p *SSHRunner) Run(ctx *Context) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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