dao

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package dao for evaluating boolean tag expressions against project tags.

Index

Constants

This section is empty.

Variables

View Source
var (
	DEFAULT_SHELL         = "bash -c"
	DEFAULT_SHELL_PROGRAM = "bash"
	ACCEPTABLE_FILE_NAMES = []string{"mani.yaml", "mani.yml", ".mani.yaml", ".mani.yml"}

	DEFAULT_THEME = Theme{
		Name:   "default",
		Stream: DefaultStream,
		Table:  DefaultTable,
		Tree:   DefaultTree,
		TUI:    DefaultTUI,
		Block:  DefaultBlock,
		Color:  core.Ptr(true),
	}

	DEFAULT_TARGET = Target{
		Name: "default",

		All: false,
		Cwd: false,

		Projects: []string{},
		Paths:    []string{},
		Tags:     []string{},

		TagsExpr: "",
	}

	DEFAULT_SPEC = Spec{
		Name:   "default",
		Output: "stream",

		Parallel: false,
		Forks:    4,

		IgnoreErrors:      false,
		IgnoreNonExisting: false,

		OmitEmptyRows:    false,
		OmitEmptyColumns: false,

		ClearOutput: true,
	}
)
View Source
var DefaultBlock = Block{
	Key: &ColorOptions{
		Fg:     core.Ptr("#5f87d7"),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	Separator: &ColorOptions{
		Fg:     core.Ptr("#5f87d7"),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	Value: &ColorOptions{
		Fg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	ValueTrue: &ColorOptions{
		Fg:     core.Ptr("#00af5f"),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	ValueFalse: &ColorOptions{
		Fg:     core.Ptr("#d75f5f"),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
}
View Source
var DefaultStream = Stream{
	Prefix:       true,
	Header:       true,
	HeaderPrefix: "TASK",
	HeaderChar:   "*",
	PrefixColors: []string{"#d787ff", "#00af5f", "#d75f5f", "#5f87d7", "#00af87", "#5f00ff"},
}
View Source
var DefaultTUI = TUI{
	Default: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	Border: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
	BorderFocus: &ColorOptions{
		Fg:     core.Ptr("#d787ff"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	Title: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Align:  core.Ptr("center"),
		Format: core.Ptr(""),
	},
	TitleActive: &ColorOptions{
		Fg:     core.Ptr("#000000"),
		Bg:     core.Ptr("#d787ff"),
		Attr:   core.Ptr(""),
		Align:  core.Ptr("center"),
		Format: core.Ptr(""),
	},

	Button: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Align:  core.Ptr(""),
		Format: core.Ptr(""),
	},
	ButtonActive: &ColorOptions{
		Fg:     core.Ptr("#080808"),
		Bg:     core.Ptr("#d787ff"),
		Attr:   core.Ptr(""),
		Align:  core.Ptr(""),
		Format: core.Ptr(""),
	},

	Item: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
	ItemFocused: &ColorOptions{
		Fg:     core.Ptr("#ffffff"),
		Bg:     core.Ptr("#262626"),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
	ItemSelected: &ColorOptions{
		Fg:     core.Ptr("#5f87d7"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
	ItemDir: &ColorOptions{
		Fg:     core.Ptr("#d787ff"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
	ItemRef: &ColorOptions{
		Fg:     core.Ptr("#d787ff"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	TableHeader: &ColorOptions{
		Fg:     core.Ptr("#d787ff"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr("bold"),
		Align:  core.Ptr("left"),
		Format: core.Ptr(""),
	},

	SearchLabel: &ColorOptions{
		Fg:     core.Ptr("#d7d75f"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr("bold"),
		Format: core.Ptr(""),
	},
	SearchText: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	FilterLabel: &ColorOptions{
		Fg:     core.Ptr("#d7d75f"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr("bold"),
		Format: core.Ptr(""),
	},
	FilterText: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},

	ShortcutLabel: &ColorOptions{
		Fg:     core.Ptr("#00af5f"),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
	ShortcutText: &ColorOptions{
		Fg:     core.Ptr(""),
		Bg:     core.Ptr(""),
		Attr:   core.Ptr(""),
		Format: core.Ptr(""),
	},
}

DefaultTUI Not all attributes are used, but no clean way to add them since MergeThemeOptions initializes all of the fields.

View Source
var DefaultTable = Table{
	Box: table.StyleDefault.Box,

	Style: "ascii",

	Border: &Border{
		Around:  core.Ptr(false),
		Columns: core.Ptr(true),
		Header:  core.Ptr(true),
		Rows:    core.Ptr(true),
	},

	Header: &ColorOptions{
		Fg:     core.Ptr("#d787ff"),
		Attr:   core.Ptr("bold"),
		Format: core.Ptr(""),
	},

	TitleColumn: &ColorOptions{
		Fg:     core.Ptr("#5f87d7"),
		Attr:   core.Ptr("bold"),
		Format: core.Ptr(""),
	},
}
View Source
var DefaultTree = Tree{
	Style: "light",
}

Functions

func CheckUserColor added in v0.30.0

func CheckUserColor(colorFlag bool) bool

func EvaluateEnv added in v0.20.0

func EvaluateEnv(envList []string) ([]string, error)

func FormatErrors added in v0.20.0

func FormatErrors(re Resource, errs []error) error

func IsGitWorktree added in v0.32.0

func IsGitWorktree(path string) (bool, error)

IsGitWorktree checks if the given path is a git worktree (not the main repo).

A worktree's .git is a FILE (not directory) containing: "gitdir: /path/to/main-repo/.git/worktrees/worktree-name"

func LoadBlockTheme added in v0.30.0

func LoadBlockTheme(block *Block)

func LoadStreamTheme added in v0.30.0

func LoadStreamTheme(stream *Stream)

func LoadTUITheme added in v0.30.0

func LoadTUITheme(tui *TUI)

func LoadTableTheme added in v0.30.0

func LoadTableTheme(mTable *Table)

func LoadTreeTheme added in v0.30.0

func LoadTreeTheme(tree *Tree)

func MergeEnvs added in v0.20.0

func MergeEnvs(envs ...[]string) []string

MergeEnvs Merges environment variables. Priority is from highest to lowest (1st env takes precedence over the last entry).

func ParseCmd added in v0.30.0

func ParseCmd(
	cmd string,
	runFlags *core.RunFlags,
	setFlags *core.SetRunFlags,
	config *Config,
) ([]Task, []Project, error)

func ParseManyTasks added in v0.30.0

func ParseManyTasks(
	taskNames []string,
	runFlags *core.RunFlags,
	setFlags *core.SetRunFlags,
	config *Config,
) ([]Task, []Project, error)

func ParseNodeEnv added in v0.20.0

func ParseNodeEnv(node yaml.Node) []string

func ParseSingleTask added in v0.30.0

func ParseSingleTask(
	taskName string,
	runFlags *core.RunFlags,
	setFlags *core.SetRunFlags,
	config *Config,
) ([]Task, []Project, error)

func ParseTaskEnv added in v0.20.0

func ParseTaskEnv(
	env yaml.Node,
	userEnv []string,
	parentEnv []string,
	configEnv []string,
) ([]string, error)

func ParseTasksEnv added in v0.30.0

func ParseTasksEnv(tasks []Task)

func RenameDuplicates added in v0.20.0

func RenameDuplicates(projects []Project)

func StyleFg added in v0.30.0

func StyleFg(colr string) color.RGBColor

Used for gookit/color printing stream

func StyleFormat added in v0.30.0

func StyleFormat(text string, format string) string

func StyleString added in v0.30.0

func StyleString(text string, opts ColorOptions, useColors bool) string

Used for gookit/color printing tables/blocks

func TaskSpinner added in v0.6.1

func TaskSpinner() (yacspin.Spinner, error)

func UpdateProjectsToGitignore

func UpdateProjectsToGitignore(projectNames []string, gitignoreFilename string) (err error)

Types

type Block added in v0.30.0

type Block struct {
	Key        *ColorOptions `yaml:"key"`
	Separator  *ColorOptions `yaml:"separator"`
	Value      *ColorOptions `yaml:"value"`
	ValueTrue  *ColorOptions `yaml:"value_true"`
	ValueFalse *ColorOptions `yaml:"value_false"`
}

type Border added in v0.30.0

type Border struct {
	Around  *bool `yaml:"around"`
	Columns *bool `yaml:"columns"`
	Header  *bool `yaml:"header"`
	Rows    *bool `yaml:"rows"`
}

type ColorOptions added in v0.20.0

type ColorOptions struct {
	Fg     *string `yaml:"fg"`
	Bg     *string `yaml:"bg"`
	Align  *string `yaml:"align"`
	Attr   *string `yaml:"attr"`
	Format *string `yaml:"format"`
}

func MergeThemeOptions added in v0.30.0

func MergeThemeOptions(userOption *ColorOptions, defaultOption *ColorOptions) *ColorOptions

Merges default with user theme. Converts colors to hex, and align, attr, and format to its backend representation (single character).

type Command

type Command struct {
	Name    string    `yaml:"name"`
	Desc    string    `yaml:"desc"`
	Shell   string    `yaml:"shell"` // should be in the format: <program> <command flag>, for instance "sh -c", "node -e"
	Cmd     string    `yaml:"cmd"`   // "echo hello world", it should not include the program flag (-c,-e, .etc)
	Task    string    `yaml:"task"`
	TaskRef string    `yaml:"-"` // Keep a reference to the task
	TTY     bool      `yaml:"tty"`
	Env     yaml.Node `yaml:"env"`
	EnvList []string  `yaml:"-"`

	// Internal
	ShellProgram string   `yaml:"-"` // should be in the format: <program>, example: "sh", "node"
	CmdArg       []string `yaml:"-"` // is in the format ["-c echo hello world"] or ["-c", "echo hello world"], it includes the shell flag
}

type Config

type Config struct {
	// Internal
	EnvList        []string  `yaml:"-"`
	ImportData     []Import  `yaml:"-"`
	ThemeList      []Theme   `yaml:"-"`
	SpecList       []Spec    `yaml:"-"`
	TargetList     []Target  `yaml:"-"`
	ProjectList    []Project `yaml:"-"`
	TaskList       []Task    `yaml:"-"`
	Path           string    `yaml:"-"`
	Dir            string    `yaml:"-"`
	UserConfigFile *string   `yaml:"-"`
	ConfigPaths    []string  `yaml:"-"`
	Color          bool      `yaml:"-"`

	Shell                   string `yaml:"shell"`
	SyncRemotes             *bool  `yaml:"sync_remotes"`
	SyncGitignore           *bool  `yaml:"sync_gitignore"`
	RemoveOrphanedWorktrees *bool  `yaml:"remove_orphaned_worktrees"`
	ReloadTUI               *bool  `yaml:"reload_tui_on_change"`

	// Intermediate
	Env      yaml.Node `yaml:"env"`
	Import   yaml.Node `yaml:"import"`
	Themes   yaml.Node `yaml:"themes"`
	Specs    yaml.Node `yaml:"specs"`
	Targets  yaml.Node `yaml:"targets"`
	Projects yaml.Node `yaml:"projects"`
	Tasks    yaml.Node `yaml:"tasks"`
}

func ReadConfig

func ReadConfig(configFilepath string, userConfigPath string, colorFlag bool) (Config, error)

Function to read Mani configs.

func (*Config) CheckConfigNoColor added in v0.20.0

func (c *Config) CheckConfigNoColor()

func (Config) EditConfig added in v0.10.0

func (c Config) EditConfig() error

Open mani config in editor

func (Config) EditProject added in v0.10.0

func (c Config) EditProject(name string) error

Open mani config in editor and optionally go to line matching the project name

func (Config) EditTask added in v0.10.0

func (c Config) EditTask(name string) error

Open mani config in editor and optionally go to line matching the task name

func (Config) FilterProjects

func (c Config) FilterProjects(
	cwdFlag bool,
	allProjectsFlag bool,
	projectsFlag []string,
	projectPathsFlag []string,
	tagsFlag []string,
	tagsExprFlag string,
) ([]Project, error)

FilterProjects filters the project list based on various criteria. It supports filtering by: - All projects (allProjectsFlag) - Current working directory (cwdFlag) - Project names (projectsFlag) - Project paths (projectPathsFlag) - Project tags (tagsFlag) - Tag expressions (tagsExprFlag)

Priority handling:

  • If cwdFlag is true, the function immediately returns only the current working directory project, ignoring all other filters.
  • For all other combinations of filters, the function collects projects from each filter into separate slices, then finds their intersection. If multiple filters are specified, only projects that match ALL filters will be returned.

func (Config) GetCommand

func (c Config) GetCommand(taskName string) (*Command, error)

func (*Config) GetContext added in v0.20.0

func (c *Config) GetContext() string

func (*Config) GetContextLine added in v0.20.0

func (c *Config) GetContextLine() int

func (Config) GetCwdProject

func (c Config) GetCwdProject() (Project, error)

func (Config) GetEnvList added in v0.10.0

func (c Config) GetEnvList() []string

Returns the config env list as a string splice in the form [key=value, key1=$(echo 123)]

func (Config) GetFilteredProjects added in v0.30.0

func (c Config) GetFilteredProjects(flags *core.ProjectFlags) ([]Project, error)

GetFilteredProjects retrieves a filtered list of projects based on the provided ProjectFlags. It processes various filtering criteria and returns the matching projects.

The function follows these steps: 1. If a target is specified, loads the target configuration, otherwise sets all to false 2. Merges any provided flag values with the target configuration 3. Applies all filtering criteria using FilterProjects

func (*Config) GetImportList added in v0.20.0

func (c *Config) GetImportList() ([]Import, []ResourceErrors[Import])

Populates SpecList and creates a default spec if no default spec is set.

func (Config) GetIntersectProjects added in v0.30.0

func (c Config) GetIntersectProjects(ps ...[]Project) []Project

func (Config) GetProject added in v0.10.0

func (c Config) GetProject(name string) (*Project, error)

func (*Config) GetProjectList added in v0.10.0

func (c *Config) GetProjectList() ([]Project, []ResourceErrors[Project])

func (Config) GetProjectNames

func (c Config) GetProjectNames() []string

func (Config) GetProjectPaths added in v0.10.0

func (c Config) GetProjectPaths() []string

*

  • GetProjectPaths For each project path, get all the enumerations of dirnames.
  • Example:
  • Input:
  • - /frontend/tools/project-a
  • - /frontend/tools/project-b
  • - /frontend/tools/node/project-c
  • - /backend/project-d
  • Output:
  • - /frontend
  • - /frontend/tools
  • - /frontend/tools/node
  • - /backend

func (Config) GetProjectUrls

func (c Config) GetProjectUrls() []string

func (Config) GetProjectsByName

func (c Config) GetProjectsByName(projectNames []string) ([]Project, error)

func (Config) GetProjectsByPath added in v0.10.0

func (c Config) GetProjectsByPath(dirs []string) ([]Project, error)

GetProjectsByPath Projects must have all dirs to match. If user provides a path which does not exist, then return error containing all the paths it didn't find. Supports glob patterns: - '*' matches any sequence of non-separator characters - '**' matches any sequence of characters including separators

func (Config) GetProjectsByTags

func (c Config) GetProjectsByTags(tags []string) ([]Project, error)

GetProjectsByTags Projects must have all tags to match. For instance, if --tags frontend,backend is passed, then a project must have both tags. We only return error if the flags provided do not exist in the mani config.

func (Config) GetProjectsByTagsExpr added in v0.30.0

func (c Config) GetProjectsByTagsExpr(tagsExpr string) ([]Project, error)

GetProjectsByTagsExpr Projects must have all tags to match. For instance, if --tags frontend,backend is passed, then a project must have both tags. We only return error if the tags provided do not exist.

func (Config) GetProjectsTree added in v0.6.1

func (c Config) GetProjectsTree(dirs []string, tags []string) ([]TreeNode, error)

func (Config) GetSpec added in v0.12.0

func (c Config) GetSpec(name string) (*Spec, error)

func (*Config) GetSpecList added in v0.12.0

func (c *Config) GetSpecList() ([]Spec, []ResourceErrors[Spec])

Populates SpecList and creates a default spec if no default spec is set.

func (Config) GetSpecNames added in v0.12.0

func (c Config) GetSpecNames() []string

func (Config) GetTagAssocations added in v0.10.0

func (c Config) GetTagAssocations(tags []string) ([]Tag, error)

func (Config) GetTags

func (c Config) GetTags() []string

func (Config) GetTarget added in v0.12.0

func (c Config) GetTarget(name string) (*Target, error)

func (*Config) GetTargetList added in v0.12.0

func (c *Config) GetTargetList() ([]Target, []ResourceErrors[Target])

Populates TargetList and creates a default target if no default target is set.

func (Config) GetTargetNames added in v0.12.0

func (c Config) GetTargetNames() []string

func (Config) GetTask added in v0.6.1

func (c Config) GetTask(name string) (*Task, error)

func (*Config) GetTaskList added in v0.10.0

func (c *Config) GetTaskList() ([]Task, []ResourceErrors[Task])

func (Config) GetTaskNameAndDesc added in v0.20.0

func (c Config) GetTaskNameAndDesc() []string

func (Config) GetTaskNames added in v0.6.1

func (c Config) GetTaskNames() []string

func (Config) GetTaskProjects added in v0.12.0

func (c Config) GetTaskProjects(
	task *Task,
	flags *core.RunFlags,
	setFlags *core.SetRunFlags,
) ([]Project, error)

GetTaskProjects retrieves a filtered list of projects for a given task, applying runtime flag overrides and target configurations.

Behavior depends on the provided runtime flags (flags, setFlags) and task target:

  • If runtime flags are set (Projects, Paths, Tags, etc.), they take precedence and reset the task's target configuration.
  • If a target is explicitly specified (flags.Target), it loads and applies that target's configuration before applying runtime flag overrides.
  • If no runtime flags or target are provided, the task's default target data is used.

Filtering priority (highest to lowest):

  1. Runtime flags (e.g., --projects, --tags, --cwd)
  2. Explicit target configuration (--target)
  3. Task's default target data (if no overrides exist)

Returns:

  • Filtered []Project based on the resolved configuration.
  • Non-nil error if target resolution or project filtering fails.

func (Config) GetTasksByNames added in v0.6.1

func (c Config) GetTasksByNames(names []string) ([]Task, error)

func (Config) GetTheme added in v0.10.0

func (c Config) GetTheme(name string) (*Theme, error)

func (Config) GetThemeNames added in v0.10.0

func (c Config) GetThemeNames() []string

func (*Config) ParseThemes added in v0.30.0

func (c *Config) ParseThemes() ([]Theme, []ResourceErrors[Theme])

Populates ThemeList

type ConfigResources added in v0.10.0

type ConfigResources struct {
	Imports  []Import
	Themes   []Theme
	Specs    []Spec
	Targets  []Target
	Tasks    []Task
	Projects []Project
	Envs     []string

	ThemeErrors   []ResourceErrors[Theme]
	SpecErrors    []ResourceErrors[Spec]
	TargetErrors  []ResourceErrors[Target]
	TaskErrors    []ResourceErrors[Task]
	ProjectErrors []ResourceErrors[Project]
	ImportErrors  []ResourceErrors[Import]
}

Used for config imports

type FoundCyclicDependency added in v0.20.0

type FoundCyclicDependency struct {
	Cycles []NodeLink
}

func (*FoundCyclicDependency) Error added in v0.20.0

func (c *FoundCyclicDependency) Error() string

type Import added in v0.20.0

type Import struct {
	Path string
	// contains filtered or unexported fields
}

func (*Import) GetContext added in v0.20.0

func (i *Import) GetContext() string

func (*Import) GetContextLine added in v0.20.0

func (i *Import) GetContextLine() int

type Lexer added in v0.30.0

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

func NewLexer added in v0.30.0

func NewLexer(input string) *Lexer

func (*Lexer) Tokenize added in v0.30.0

func (l *Lexer) Tokenize() error

type Node added in v0.20.0

type Node struct {
	Path     string
	Imports  []Import
	Visiting bool
	Visited  bool
}
type NodeLink struct {
	A Node
	B Node
}

type Parser added in v0.30.0

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

func NewParser added in v0.30.0

func NewParser(tokens []Token, project *Project) *Parser

func (*Parser) Parse added in v0.30.0

func (p *Parser) Parse() (bool, error)

type Position added in v0.30.0

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

type Project

type Project struct {
	Name         string   `yaml:"name"`
	Path         string   `yaml:"path"`
	Desc         string   `yaml:"desc"`
	URL          string   `yaml:"url"`
	Clone        string   `yaml:"clone"`
	Branch       string   `yaml:"branch"`
	SingleBranch *bool    `yaml:"single_branch"`
	Sync         *bool    `yaml:"sync"`
	Tags         []string `yaml:"tags"`
	EnvList      []string `yaml:"-"`
	RemoteList   []Remote `yaml:"-"`

	Env          yaml.Node  `yaml:"env"`
	Remotes      yaml.Node  `yaml:"remotes"`
	Worktrees    yaml.Node  `yaml:"worktrees"`
	WorktreeList []Worktree `yaml:"-"`

	RelPath string
	// contains filtered or unexported fields
}

func FindVCSystems

func FindVCSystems(rootPath string) ([]Project, error)

func InitMani added in v0.10.0

func InitMani(args []string, initFlags core.InitFlags) ([]Project, error)

func (*Project) GetContext added in v0.20.0

func (p *Project) GetContext() string

func (*Project) GetContextLine added in v0.20.0

func (p *Project) GetContextLine() int

func (Project) GetValue

func (p Project) GetValue(key string, _ int) string

func (Project) IsSingleBranch added in v0.30.0

func (p Project) IsSingleBranch() bool

func (Project) IsSync added in v0.20.0

func (p Project) IsSync() bool

type Remote added in v0.24.0

type Remote struct {
	Name string
	URL  string
}

func ParseRemotes added in v0.24.0

func ParseRemotes(node yaml.Node) []Remote

ParseRemotes List of remotes (key: value)

type Resource added in v0.20.0

type Resource interface {
	GetContext() string
	GetContextLine() int
}

type ResourceErrors added in v0.20.0

type ResourceErrors[T any] struct {
	Resource *T
	Errors   []error
}

type Row added in v0.20.0

type Row struct {
	Columns []string
}

func (Row) GetValue added in v0.20.0

func (r Row) GetValue(_ string, i int) string

type Spec added in v0.12.0

type Spec struct {
	Name              string `yaml:"name"`
	Output            string `yaml:"output"`
	Parallel          bool   `yaml:"parallel"`
	IgnoreErrors      bool   `yaml:"ignore_errors"`
	IgnoreNonExisting bool   `yaml:"ignore_non_existing"`
	OmitEmptyRows     bool   `yaml:"omit_empty_rows"`
	OmitEmptyColumns  bool   `yaml:"omit_empty_columns"`
	ClearOutput       bool   `yaml:"clear_output"`
	Forks             uint32 `yaml:"forks"`
	// contains filtered or unexported fields
}

func (*Spec) GetContext added in v0.20.0

func (s *Spec) GetContext() string

func (*Spec) GetContextLine added in v0.20.0

func (s *Spec) GetContextLine() int

type Stream added in v0.30.0

type Stream struct {
	Prefix       bool     `yaml:"prefix"`
	PrefixColors []string `yaml:"prefix_colors"`
	Header       bool     `yaml:"header"`
	HeaderChar   string   `yaml:"header_char"`
	HeaderPrefix string   `yaml:"header_prefix"`
}

type TNode added in v0.30.0

type TNode struct {
	Name string
	Path string
}

type TUI added in v0.30.0

type TUI struct {
	Default *ColorOptions `yaml:"default"`

	Border      *ColorOptions `yaml:"border"`
	BorderFocus *ColorOptions `yaml:"border_focus"`

	Title       *ColorOptions `yaml:"title"`
	TitleActive *ColorOptions `yaml:"title_active"`

	TableHeader *ColorOptions `yaml:"table_header"`

	Item         *ColorOptions `yaml:"item"`
	ItemFocused  *ColorOptions `yaml:"item_focused"`
	ItemSelected *ColorOptions `yaml:"item_selected"`
	ItemDir      *ColorOptions `yaml:"item_dir"`
	ItemRef      *ColorOptions `yaml:"item_ref"`

	Button       *ColorOptions `yaml:"button"`
	ButtonActive *ColorOptions `yaml:"button_active"`

	SearchLabel *ColorOptions `yaml:"search_label"`
	SearchText  *ColorOptions `yaml:"search_text"`

	FilterLabel *ColorOptions `yaml:"filter_label"`
	FilterText  *ColorOptions `yaml:"filter_text"`

	ShortcutLabel *ColorOptions `yaml:"shortcut_label"`
	ShortcutText  *ColorOptions `yaml:"shortcut_text"`
}

type Table added in v0.20.0

type Table struct {
	// Stylable via YAML
	Style       string        `yaml:"style"`
	Border      *Border       `yaml:"border"`
	Header      *ColorOptions `yaml:"header"`
	TitleColumn *ColorOptions `yaml:"title_column"`

	// Not stylable via YAML
	Box table.BoxStyle `yaml:"-"`
}

type TableOutput added in v0.20.0

type TableOutput struct {
	Headers []string
	Rows    []Row
}

type Tag added in v0.20.0

type Tag struct {
	Name     string
	Projects []string
}

func (Tag) GetValue added in v0.20.0

func (t Tag) GetValue(key string, _ int) string

type Target added in v0.10.0

type Target struct {
	Name     string   `yaml:"name"`
	All      bool     `yaml:"all"`
	Projects []string `yaml:"projects"`
	Paths    []string `yaml:"paths"`
	Tags     []string `yaml:"tags"`
	TagsExpr string   `yaml:"tags_expr"`
	Cwd      bool     `yaml:"cwd"`
	// contains filtered or unexported fields
}

func (*Target) GetContext added in v0.20.0

func (t *Target) GetContext() string

func (*Target) GetContextLine added in v0.20.0

func (t *Target) GetContextLine() int

type Task added in v0.6.1

type Task struct {
	SpecData   Spec
	TargetData Target
	ThemeData  Theme

	Name     string    `yaml:"name"`
	Desc     string    `yaml:"desc"`
	Shell    string    `yaml:"shell"`
	Cmd      string    `yaml:"cmd"`
	Commands []Command `yaml:"commands"`
	EnvList  []string  `yaml:"-"`
	TTY      bool      `yaml:"tty"`

	Env    yaml.Node `yaml:"env"`
	Spec   yaml.Node `yaml:"spec"`
	Target yaml.Node `yaml:"target"`
	Theme  yaml.Node `yaml:"theme"`

	// Internal
	ShellProgram string   `yaml:"-"` // should be in the format: <program>, example: "sh", "node"
	CmdArg       []string `yaml:"-"` // is in the format ["-c echo hello world"] or ["-c", "echo hello world"], it includes the shell flag
	// contains filtered or unexported fields
}

func (Task) ConvertTaskToCommand added in v0.30.0

func (t Task) ConvertTaskToCommand() Command

func (*Task) GetContext added in v0.20.0

func (t *Task) GetContext() string

func (*Task) GetContextLine added in v0.20.0

func (t *Task) GetContextLine() int

func (Task) GetValue added in v0.10.0

func (t Task) GetValue(key string, _ int) string

func (*Task) ParseTask added in v0.10.0

func (t *Task) ParseTask(config Config, taskErrors *ResourceErrors[Task])

ParseTask parses tasks and builds the correct "AST". Depending on if the data is specified inline, or if it is a reference to resource, it will handle them differently.

type Theme added in v0.10.0

type Theme struct {
	Name   string `yaml:"name"`
	Table  Table  `yaml:"table"`
	Tree   Tree   `yaml:"tree"`
	Stream Stream `yaml:"stream"`
	Block  Block  `yaml:"block"`
	TUI    TUI    `yaml:"tui"`
	Color  *bool  `yaml:"color"`
	// contains filtered or unexported fields
}

func (*Theme) GetContext added in v0.20.0

func (t *Theme) GetContext() string

func (*Theme) GetContextLine added in v0.20.0

func (t *Theme) GetContextLine() int

type Token added in v0.30.0

type Token struct {
	Type     TokenType
	Value    string
	Position Position
}

type TokenType added in v0.30.0

type TokenType int
const (
	TokenTag TokenType = iota
	TokenAnd
	TokenOr
	TokenNot
	TokenLParent
	TokenRParen
	TokenEOF
)

type Tree added in v0.20.0

type Tree struct {
	Style string `yaml:"style"`
}

type TreeNode added in v0.20.0

type TreeNode struct {
	Path        string
	ProjectName string
	Children    []TreeNode
}

func AddToTree added in v0.20.0

func AddToTree(root []TreeNode, node TNode) []TreeNode

AddToTree recursively builds a tree structure from path components root: The current level of tree nodes node: Node containing path and name information to be added

type Worktree added in v0.32.0

type Worktree struct {
	Path   string `yaml:"path"`
	Branch string `yaml:"branch"`
}

func ParseWorktrees added in v0.32.0

func ParseWorktrees(node yaml.Node) ([]Worktree, error)

ParseWorktrees parses worktree definitions from YAML

Jump to

Keyboard shortcuts

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