gomk

package module
v0.0.0-...-ed6364d Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

README

gomk

Make things Go

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Try

func Try(f func()) (err error)

Types

type Build

type Build struct {
	PrjRoot string
	Env     Env
}

func MustNewBuild

func MustNewBuild(rootDir string, osEnv []string) *Build

func NewBuild

func NewBuild(rootDir string, osEnv []string) (*Build, error)

func (*Build) WDir

func (b *Build) WDir() *WDir

func (*Build) WithEnv

func (b *Build) WithEnv(change func(*Env), do func())

type Env

type Env struct {
	// contains filtered or unexported fields
}
Example
var e Env
e.Set("KEY1", "Just a value")
fmt.Println(e.CmdEnv())
e.Set("KEY2", "Yet another value")
fmt.Println(e.CmdEnv())
fmt.Println(e.Get("KEY1"))
e.Unset("KEY1")
fmt.Println(e.CmdEnv())
fmt.Println(e.Get("KEY1"))
Output:
[KEY1=Just a value]
[KEY1=Just a value KEY2=Yet another value]
Just a value true
[KEY2=Yet another value]
 false

func NewEnvOS

func NewEnvOS(osenv []string) (*Env, error)
Example
e, _ := NewEnvOS([]string{
	"KEY1=Just a value",
	"KEY2=Yet another value",
})
fmt.Println(e.CmdEnv())
Output:
[KEY1=Just a value KEY2=Yet another value]

func (*Env) CmdEnv

func (env *Env) CmdEnv() []string

func (*Env) Get

func (env *Env) Get(key string) (string, bool)

func (*Env) New

func (env *Env) New() *Env

func (*Env) Pop

func (env *Env) Pop() bool

func (*Env) Push

func (env *Env) Push()

func (*Env) Set

func (env *Env) Set(key, val string)

func (*Env) SetMap

func (env *Env) SetMap(e map[string]string)

func (*Env) Unset

func (env *Env) Unset(keys ...string)

type PipeError

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

func (PipeError) Error

func (pe PipeError) Error() string

func (PipeError) Unwrap

func (pe PipeError) Unwrap() error

type Tasks

type Tasks map[string]*taskdef

func (Tasks) Def

func (ts Tasks) Def(name string, do func(*WDir), before ...string)

func (Tasks) Run

func (ts Tasks) Run(task string, dir *WDir)

type WDir

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

func (*WDir) Back

func (d *WDir) Back() *WDir

func (*WDir) Build

func (d *WDir) Build() *Build

func (*WDir) Cd

func (d *WDir) Cd(dirs ...string) *WDir

func (*WDir) Do

func (d *WDir) Do(what string, f func(dir *WDir))

func (*WDir) Exec

func (d *WDir) Exec(exe string, args ...string)

func (*WDir) ExecPipe

func (d *WDir) ExecPipe(cmds ...*exec.Cmd)

func (*WDir) Rel

func (d *WDir) Rel() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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