babfile

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const TaskNamePattern = "^[a-zA-Z0-9_-]+(:[a-zA-Z0-9_-]+)*$"
View Source
const VarNamePattern = "^[a-zA-Z_][a-zA-Z0-9_]*$"

Variables

Functions

func CommandRunSchema added in v0.4.2

func CommandRunSchema() *jsonschema.Schema

func DepsSchema added in v0.3.1

func DepsSchema() *jsonschema.Schema

func DirSchema added in v0.6.3

func DirSchema() *jsonschema.Schema

func EnvSchema added in v0.3.13

func EnvSchema() *jsonschema.Schema

func LogLevelSchema added in v0.4.2

func LogLevelSchema() *jsonschema.Schema

func LogRunSchema added in v0.4.2

func LogRunSchema() *jsonschema.Schema

func MergeEnv added in v0.3.13

func MergeEnv(envMaps ...map[string]string) []string

func MergeEnvMaps added in v0.3.13

func MergeEnvMaps(envMaps ...map[string]string) map[string]string

func OutputSchema added in v0.5.1

func OutputSchema() *jsonschema.Schema

func PlatformsArraySchema added in v0.3.1

func PlatformsArraySchema() *jsonschema.Schema

func PromptRunSchema added in v0.6.0

func PromptRunSchema() *jsonschema.Schema

func PromptTypeSchema added in v0.6.0

func PromptTypeSchema() *jsonschema.Schema

func RunItemSchema added in v0.3.1

func RunItemSchema() *jsonschema.Schema

func SilentSchema added in v0.5.1

func SilentSchema() *jsonschema.Schema

func TaskNameSchema added in v0.3.5

func TaskNameSchema() *jsonschema.Schema

func TaskRunSchema added in v0.4.2

func TaskRunSchema() *jsonschema.Schema

func VarsSchema added in v0.5.0

func VarsSchema() *jsonschema.Schema

func WhenSchema added in v0.7.0

func WhenSchema() *jsonschema.Schema

Types

type CommandRun added in v0.3.1

type CommandRun struct {
	Line      int               `json:"-" yaml:"-"`
	Cmd       string            `json:"cmd" yaml:"cmd"`
	Dir       string            `json:"dir,omitempty" yaml:"dir,omitempty"`
	Env       map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	Silent    *bool             `json:"silent,omitempty" yaml:"silent,omitempty"`
	Output    *bool             `json:"output,omitempty" yaml:"output,omitempty"`
	Platforms []Platform        `json:"platforms,omitempty" yaml:"platforms,omitempty"`
	When      string            `json:"when,omitempty" yaml:"when,omitempty"`
}

func (CommandRun) GetWhen added in v0.7.0

func (c CommandRun) GetWhen() string

func (CommandRun) ShouldRunOnPlatform added in v0.3.5

func (c CommandRun) ShouldRunOnPlatform(platform string) bool

type Include

type Include struct {
	Babfile string `json:"babfile" yaml:"babfile"`
}

func (Include) JSONSchema added in v0.3.1

func (Include) JSONSchema() *jsonschema.Schema

type LogLevel added in v0.4.2

type LogLevel string
const (
	LogLevelDebug LogLevel = "debug"
	LogLevelInfo  LogLevel = "info"
	LogLevelWarn  LogLevel = "warn"
	LogLevelError LogLevel = "error"
)

func (LogLevel) String added in v0.4.2

func (l LogLevel) String() string

func (LogLevel) Valid added in v0.4.2

func (l LogLevel) Valid() bool

type LogRun added in v0.4.2

type LogRun struct {
	Line      int        `json:"-" yaml:"-"`
	Log       string     `json:"log" yaml:"log"`
	Level     LogLevel   `json:"level,omitempty" yaml:"level,omitempty"`
	Platforms []Platform `json:"platforms,omitempty" yaml:"platforms,omitempty"`
	When      string     `json:"when,omitempty" yaml:"when,omitempty"`
}

func (LogRun) GetWhen added in v0.7.0

func (l LogRun) GetWhen() string

func (LogRun) ShouldRunOnPlatform added in v0.4.2

func (l LogRun) ShouldRunOnPlatform(platform string) bool

type Platform

type Platform string
const (
	PlatformLinux   Platform = "linux"
	PlatformDarwin  Platform = "darwin"
	PlatformWindows Platform = "windows"
)

func (Platform) JSONSchema

func (Platform) JSONSchema() *jsonschema.Schema

func (Platform) String added in v0.4.2

func (p Platform) String() string

func (Platform) Valid added in v0.4.2

func (p Platform) Valid() bool

type PromptRun added in v0.6.0

type PromptRun struct {
	Line        int        `json:"-" yaml:"-"`
	Prompt      string     `json:"prompt" yaml:"prompt"`
	Type        PromptType `json:"type" yaml:"type"`
	Message     string     `json:"message" yaml:"message"`
	Platforms   []Platform `json:"platforms,omitempty" yaml:"platforms,omitempty"`
	Default     string     `json:"default,omitempty" yaml:"default,omitempty"`
	Defaults    []string   `json:"defaults,omitempty" yaml:"defaults,omitempty"`
	Options     []string   `json:"options,omitempty" yaml:"options,omitempty"`
	Placeholder string     `json:"placeholder,omitempty" yaml:"placeholder,omitempty"`
	Validate    string     `json:"validate,omitempty" yaml:"validate,omitempty"`
	Min         *int       `json:"min,omitempty" yaml:"min,omitempty"`
	Max         *int       `json:"max,omitempty" yaml:"max,omitempty"`
	Confirm     *bool      `json:"confirm,omitempty" yaml:"confirm,omitempty"`
	When        string     `json:"when,omitempty" yaml:"when,omitempty"`
}

func (PromptRun) GetWhen added in v0.7.0

func (p PromptRun) GetWhen() string

func (PromptRun) ShouldRunOnPlatform added in v0.6.0

func (p PromptRun) ShouldRunOnPlatform(platform string) bool

type PromptType added in v0.6.0

type PromptType string
const (
	PromptTypeConfirm     PromptType = "confirm"
	PromptTypeInput       PromptType = "input"
	PromptTypeSelect      PromptType = "select"
	PromptTypeMultiselect PromptType = "multiselect"
	PromptTypePassword    PromptType = "password"
	PromptTypeNumber      PromptType = "number"
)

func (PromptType) RequiresOptions added in v0.6.0

func (p PromptType) RequiresOptions() bool

func (PromptType) String added in v0.6.0

func (p PromptType) String() string

func (PromptType) Valid added in v0.6.0

func (p PromptType) Valid() bool

type RunItem added in v0.3.1

type RunItem interface {
	ShouldRunOnPlatform(platform string) bool
	GetWhen() string
	// contains filtered or unexported methods
}

type Schema

type Schema struct {
	Vars     VarMap             `json:"vars,omitempty" yaml:"vars,omitempty"`
	Env      map[string]string  `json:"env,omitempty" yaml:"env,omitempty"`
	Silent   *bool              `json:"silent,omitempty" yaml:"silent,omitempty"`
	Output   *bool              `json:"output,omitempty" yaml:"output,omitempty"`
	Dir      string             `json:"dir,omitempty" yaml:"dir,omitempty"`
	Includes map[string]Include `json:"includes,omitempty" yaml:"includes,omitempty"`
	Tasks    map[string]Task    `json:"tasks" yaml:"tasks"`
}

func (Schema) JSONSchema added in v0.3.1

func (Schema) JSONSchema() *jsonschema.Schema

type Task

type Task struct {
	Name       string            `json:"-" yaml:"-"`
	Line       int               `json:"-" yaml:"-"`
	DepsLine   int               `json:"-" yaml:"-"`
	SourcePath string            `json:"-" yaml:"-"`
	Desc       string            `json:"desc,omitempty" yaml:"desc,omitempty"`
	Vars       VarMap            `json:"vars,omitempty" yaml:"vars,omitempty"`
	Env        map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	Silent     *bool             `json:"silent,omitempty" yaml:"silent,omitempty"`
	Output     *bool             `json:"output,omitempty" yaml:"output,omitempty"`
	Dir        string            `json:"dir,omitempty" yaml:"dir,omitempty"`
	When       string            `json:"when,omitempty" yaml:"when,omitempty"`
	Deps       []string          `json:"deps,omitempty" yaml:"deps,omitempty"`
	Run        []RunItem         `json:"-" yaml:"-"`
}

func (Task) JSONSchema added in v0.3.1

func (Task) JSONSchema() *jsonschema.Schema

type TaskMap added in v0.3.5

type TaskMap map[string]*Task

func (TaskMap) Has added in v0.3.5

func (tm TaskMap) Has(name string) bool

func (TaskMap) Names added in v0.3.5

func (tm TaskMap) Names() []string

type TaskRun added in v0.3.1

type TaskRun struct {
	Line      int        `json:"-" yaml:"-"`
	Task      string     `json:"task" yaml:"task"`
	Silent    *bool      `json:"silent,omitempty" yaml:"silent,omitempty"`
	Output    *bool      `json:"output,omitempty" yaml:"output,omitempty"`
	Platforms []Platform `json:"platforms,omitempty" yaml:"platforms,omitempty"`
	When      string     `json:"when,omitempty" yaml:"when,omitempty"`
}

func (TaskRun) GetWhen added in v0.7.0

func (t TaskRun) GetWhen() string

func (TaskRun) ShouldRunOnPlatform added in v0.3.5

func (t TaskRun) ShouldRunOnPlatform(platform string) bool

type VarMap added in v0.5.0

type VarMap map[string]string

func MergeVarMaps added in v0.5.0

func MergeVarMaps(varMaps ...VarMap) VarMap

type Vars added in v0.5.0

type Vars map[string]string

Jump to

Keyboard shortcuts

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