action

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandExists = SimpleConditionBuilder[string]{
	CreateCondition: func(arg string) func() (bool, error) {
		return func() (bool, error) {
			return exec.CommandExists(arg), nil
		}
	},
	String: func(s string) string {
		return fmt.Sprintf("CommandExists(%s)", s)
	},
}.Init()
View Source
var Func = SimpleActionBuilder[func() error]{
	CreateRun: func(fn func() error) func() error {
		return func() error {
			return fn()
		}
	},
}.Init()
View Source
var FuncCond = SimpleConditionBuilder[func() (bool, error)]{
	CreateCondition: func(fn func() (bool, error)) func() (bool, error) {
		return func() (bool, error) {
			return fn()
		}
	},
}.Init()
View Source
var PathExists = SimpleConditionBuilder[string]{
	CreateCondition: func(arg string) func() (bool, error) {
		return func() (bool, error) {
			return file.Exists(arg), nil
		}
	},
	String: func(s string) string {
		return fmt.Sprintf("PathExists(%s)", s)
	},
}.Init()

Functions

func Run

func Run(o Object) error

func RunSilent

func RunSilent(o Object) error

Types

type Condition

type Condition interface {
	// contains filtered or unexported methods
}

func And

func And(c1 Condition, c2 Condition) Condition

func Not

func Not(c Condition) Condition

func Or

func Or(c1 Condition, c2 Condition) Condition

type Const

type Const bool

type List

type List []Object

type Object

type Object interface {
	// contains filtered or unexported methods
}

func DownloadFile

func DownloadFile(url string, path string) Object
func EnsureSymlink(source string, destination string) Object

func EnsureText

func EnsureText(path string, text string, rg *regexp.Regexp) Object

func Err

func Err(err error) Object

func Execute

func Execute(cmd *exec.Cmd, args ...string) Object

func Nop

func Nop() Object

func Scope

func Scope(fn func() Object) Object

func ShellCommand

func ShellCommand(args ...string) Object

type Optional

type Optional struct {
	Object Object
}

type SimpleAction

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

type SimpleActionBuilder

type SimpleActionBuilder[T any] struct {
	CreateRun func(T) func() error
	String    func(T) string
}

func (SimpleActionBuilder[T]) Init

func (s SimpleActionBuilder[T]) Init() func(T) Object

type SimpleCondition

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

type SimpleConditionBuilder

type SimpleConditionBuilder[T any] struct {
	String          func(T) string
	CreateCondition func(T) func() (bool, error)
}

func (SimpleConditionBuilder[T]) Init

func (s SimpleConditionBuilder[T]) Init() func(T) Condition

type WithCondition

type WithCondition struct {
	If   Condition
	Then Object
	Else Object
}

Jump to

Keyboard shortcuts

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