pkg

package
v0.0.0-...-764e94b Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugOff         = 0
	DebugOn          = 1
	DebugVerbose     = 2
	DebugVeryVerbose = 3
)

Variables

View Source
var (
	Version = "dev"
	Commit  = "-"
	Date    = "-"
)

Functions

func DetectProjectPath

func DetectProjectPath(startPath string) string

Types

type Arguments

type Arguments struct {
	Verbose     []bool   `short:"v" long:"verbose" description:"Enable debug output"`
	ConfigFiles []string `short:"c" long:"config-files" description:"Additional config files to load" default:"~/.x/config.yml"`
	Taskfiles   []string `short:"t" long:"taskfiles" description:"Additional task files to load" default:"~/.x/Taskfile"`
	Shell       string   `short:"s" long:"shell" description:"The shell to execute the commands" default:"bash"`
	Command     []string
}

func ParseArgs

func ParseArgs(args []string, stdout io.Writer) (Arguments, error)

type CommandInterface

type CommandInterface interface {
	Run() error
}

type CommandManager

type CommandManager struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
}

func (*CommandManager) Create

func (cm *CommandManager) Create(path string, command string, args []string) CommandInterface

func (*CommandManager) FindExecutable

func (cm *CommandManager) FindExecutable(name string) (string, error)

func (*CommandManager) Stop

func (cm *CommandManager) Stop(cmd CommandInterface, sig os.Signal) error

type CommandManagerInterface

type CommandManagerInterface interface {
	FindExecutable(name string) (string, error)
	Create(path string, command string, args []string) CommandInterface
	Stop(cmd CommandInterface, sig os.Signal) error
}

type Config

type Config struct {
	Name        string
	Executables map[string]struct {
		Path string
	}
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(logger IOLoggerInterface, projectPath string, additionalConfigFiles []string) (Config, error)

func (Config) PopulateModuleConfig

func (c Config) PopulateModuleConfig(moduleName string, cfg interface{}) error

type IOLogger

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

func (*IOLogger) Error

func (l *IOLogger) Error(v any)

func (*IOLogger) Log

func (l *IOLogger) Log(v any, debugLevel ...int)

type IOLoggerInterface

type IOLoggerInterface interface {
	Log(v any, debugLevel ...int)
	Error(v any)
}

func NewLogger

func NewLogger(debug int, stdout io.Writer) IOLoggerInterface

type Module

type Module interface {
	GetConfig() interface{}
	GetScript() (string, error)
}

type ModuleRegistry

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

func NewModuleRegistry

func NewModuleRegistry() *ModuleRegistry

func (*ModuleRegistry) GetModules

func (m *ModuleRegistry) GetModules() map[string]Module

type Runtime

type Runtime struct {
	Taskfile Taskfile
	// contains filtered or unexported fields
}

func NewRuntime

func NewRuntime(
	registry *ModuleRegistry,
	commandManager CommandManagerInterface,
	projectPath string,
	args Arguments,
	cfg Config,
	tf Taskfile,
	logger IOLoggerInterface,
) (*Runtime, error)

func (*Runtime) Run

func (r *Runtime) Run() error

type Taskfile

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

func NewTaskfile

func NewTaskfile(logger IOLoggerInterface, projectPath string, additionalTaskFiles []string, readFile func(string) ([]byte, error)) (Taskfile, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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