Documentation ¶
Index ¶
- Variables
- func CheckUserNoColor(noColorFlag bool)
- func EvaluateEnv(envList []string) ([]string, error)
- func FormatErrors(re Resource, errs []error) error
- func MergeEnvs(envs ...[]string) []string
- func ParseNodeEnv(node yaml.Node) []string
- func ParseTaskEnv(env yaml.Node, userEnv []string, parentEnv []string, configEnv []string) ([]string, error)
- func ProjectInSlice(name string, list []Project) bool
- func RenameDuplicates(projects []Project)
- func TaskSpinner() (yacspin.Spinner, error)
- func UpdateProjectsToGitignore(projectNames []string, gitignoreFilename string) error
- type BorderColors
- type CellColors
- type ColorOptions
- type Command
- type Config
- func (c *Config) CheckConfigNoColor()
- func (c Config) EditConfig() error
- func (c Config) EditProject(name string) error
- func (c Config) EditTask(name string) error
- func (c Config) FilterProjects(cwdFlag bool, allProjectsFlag bool, projectsFlag []string, ...) ([]Project, error)
- func (c Config) GetCommand(taskName string) (*Command, error)
- func (c *Config) GetContext() string
- func (c *Config) GetContextLine() int
- func (c Config) GetCwdProject() (Project, error)
- func (c Config) GetEnvList() []string
- func (c *Config) GetImportList() ([]Import, []ResourceErrors[Import])
- func (c Config) GetProject(name string) (*Project, error)
- func (c *Config) GetProjectList() ([]Project, []ResourceErrors[Project])
- func (c Config) GetProjectNames() []string
- func (c Config) GetProjectPaths() []string
- func (c Config) GetProjectUrls() []string
- func (c Config) GetProjectsByName(projectNames []string) ([]Project, error)
- func (c Config) GetProjectsByPath(dirs []string) ([]Project, error)
- func (c Config) GetProjectsByTags(tags []string) ([]Project, error)
- func (c Config) GetProjectsTree(dirs []string, tags []string) ([]TreeNode, error)
- func (c Config) GetSpec(name string) (*Spec, error)
- func (c *Config) GetSpecList() ([]Spec, []ResourceErrors[Spec])
- func (c Config) GetSpecNames() []string
- func (c Config) GetTagAssocations(tags []string) ([]Tag, error)
- func (c Config) GetTags() []string
- func (c Config) GetTarget(name string) (*Target, error)
- func (c *Config) GetTargetList() ([]Target, []ResourceErrors[Target])
- func (c Config) GetTargetNames() []string
- func (c Config) GetTask(name string) (*Task, error)
- func (c *Config) GetTaskList() ([]Task, []ResourceErrors[Task])
- func (c Config) GetTaskNameAndDesc() []string
- func (c Config) GetTaskNames() []string
- func (c Config) GetTaskProjects(task *Task, runFlags *core.RunFlags) ([]Project, error)
- func (c Config) GetTasksByNames(names []string) ([]Task, error)
- func (c Config) GetTheme(name string) (*Theme, error)
- func (c *Config) GetThemeList() ([]Theme, []ResourceErrors[Theme])
- func (c Config) GetThemeNames() []string
- type ConfigResources
- type FoundCyclicDependency
- type Import
- type Node
- type NodeLink
- type Project
- type Remote
- type Resource
- type ResourceErrors
- type Row
- type Spec
- type Table
- type TableColor
- type TableFormat
- type TableOptions
- type TableOutput
- type Tag
- type Target
- type Task
- type Text
- type Theme
- type Tree
- type TreeNode
Constants ¶
This section is empty.
Variables ¶
var ( DEFAULT_SHELL = "sh -c" DEFAULT_SHELL_PROGRAM = "sh" ACCEPTABLE_FILE_NAMES = []string{"mani.yaml", "mani.yml", ".mani.yaml", ".mani.yml"} DEFAULT_THEME = Theme{ Name: "default", Table: DefaultTable, Text: DefaultText, Tree: DefaultTree, } DEFAULT_TARGET = Target{ Name: "default", All: false, Projects: []string{}, Paths: []string{}, Tags: []string{}, Cwd: false, } DEFAULT_SPEC = Spec{ Name: "default", Output: "text", Parallel: false, IgnoreErrors: false, OmitEmpty: false, } )
var DefaultTable = Table{ Box: table.StyleLight.Box, Format: &TableFormat{ Header: core.Ptr("title"), Row: core.Ptr(""), }, Options: &TableOptions{ DrawBorder: core.Ptr(false), SeparateColumns: core.Ptr(true), SeparateHeader: core.Ptr(true), SeparateRows: core.Ptr(false), SeparateFooter: core.Ptr(false), }, Color: &TableColor{ Border: &BorderColors{ Header: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Attr: core.Ptr("faint"), }, Row: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Attr: core.Ptr("faint"), }, RowAlternate: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Attr: core.Ptr("faint"), }, Footer: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Attr: core.Ptr("faint"), }, }, Header: &CellColors{ Project: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, Synced: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, Tag: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, Desc: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, RelPath: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, Path: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, Url: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, Task: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, Output: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr("bold"), }, }, Row: &CellColors{ Project: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, Synced: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, Tag: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, Desc: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, RelPath: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, Path: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, Url: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, Task: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, Output: &ColorOptions{ Fg: core.Ptr(""), Bg: core.Ptr(""), Align: core.Ptr(""), Attr: core.Ptr(""), }, }, }, }
var DefaultText = Text{ Prefix: true, PrefixColors: []string{"green", "blue", "red", "yellow", "magenta", "cyan"}, Header: true, HeaderPrefix: "TASK", HeaderChar: "*", }
var DefaultTree = Tree{
Style: "light",
}
Functions ¶
func CheckUserNoColor ¶ added in v0.20.0
func CheckUserNoColor(noColorFlag bool)
func EvaluateEnv ¶ added in v0.20.0
func FormatErrors ¶ added in v0.20.0
func (re *ResourceErrors[T]) Combine() error {
func MergeEnvs ¶ added in v0.20.0
Merges environment variables. Priority is from highest to lowest (1st env takes precedence over the last entry).
func ParseNodeEnv ¶ added in v0.20.0
func ParseNodeEnv(node yaml.Node) []string
func ParseTaskEnv ¶ added in v0.20.0
func ProjectInSlice ¶
func RenameDuplicates ¶ added in v0.20.0
func RenameDuplicates(projects []Project)
func TaskSpinner ¶ added in v0.6.1
Types ¶
type BorderColors ¶ added in v0.20.0
type BorderColors struct { Header *ColorOptions `yaml:"header"` Row *ColorOptions `yaml:"row"` RowAlternate *ColorOptions `yaml:"row_alt"` }
type CellColors ¶ added in v0.20.0
type CellColors struct { Project *ColorOptions `yaml:"project"` Synced *ColorOptions `yaml:"synced"` Tag *ColorOptions `yaml:"tag"` Desc *ColorOptions `yaml:"desc"` RelPath *ColorOptions `yaml:"rel_path"` Path *ColorOptions `yaml:"path"` Url *ColorOptions `yaml:"url"` Task *ColorOptions `yaml:"task"` Output *ColorOptions `yaml:"output"` }
type ColorOptions ¶ added in v0.20.0
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"` 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:"-"` Shell string `yaml:"shell"` SyncRemotes bool `yaml:"sync_remotes"` // 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 ¶
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
Open mani config in editor
func (Config) EditProject ¶ added in v0.10.0
Open mani config in editor and optionally go to line matching the project name
func (Config) EditTask ¶ added in v0.10.0
Open mani config in editor and optionally go to line matching the task name
func (Config) FilterProjects ¶
func (*Config) GetContext ¶ added in v0.20.0
func (*Config) GetContextLine ¶ added in v0.20.0
func (Config) GetCwdProject ¶
func (Config) GetEnvList ¶ added in v0.10.0
Returns the config env list as a string splice in the form [key=value, key1=$(echo 123)]
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) GetProject ¶ added in v0.10.0
func (*Config) GetProjectList ¶ added in v0.10.0
func (c *Config) GetProjectList() ([]Project, []ResourceErrors[Project])
func (Config) GetProjectNames ¶
func (Config) GetProjectPaths ¶ added in v0.10.0
*
- 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 (Config) GetProjectsByName ¶
func (Config) GetProjectsByPath ¶ added in v0.10.0
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.
func (Config) 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) GetProjectsTree ¶ added in v0.6.1
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 (Config) GetTagAssocations ¶ added in v0.10.0
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 (*Config) GetTaskList ¶ added in v0.10.0
func (c *Config) GetTaskList() ([]Task, []ResourceErrors[Task])
func (Config) GetTaskNameAndDesc ¶ added in v0.20.0
func (Config) GetTaskNames ¶ added in v0.6.1
func (Config) GetTaskProjects ¶ added in v0.12.0
func (Config) GetTasksByNames ¶ added in v0.6.1
func (*Config) GetThemeList ¶ added in v0.10.0
func (c *Config) GetThemeList() ([]Theme, []ResourceErrors[Theme])
Populates ThemeList
func (Config) GetThemeNames ¶ added in v0.10.0
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 (*Import) GetContextLine ¶ added in v0.20.0
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"` Tags []string `yaml:"tags"` Sync *bool `yaml:"sync"` EnvList []string `yaml:"-"` RemoteList []Remote `yaml:"-"` Env yaml.Node `yaml:"env"` Remotes yaml.Node `yaml:"remotes"` RelPath string // contains filtered or unexported fields }
func FindVCSystems ¶
func GetIntersectProjects ¶
func GetUnionProjects ¶
func (*Project) GetContext ¶ added in v0.20.0
func (*Project) GetContextLine ¶ added in v0.20.0
type Remote ¶ added in v0.24.0
func ParseRemotes ¶ added in v0.24.0
func ParseRemotes(node yaml.Node) []Remote
type ResourceErrors ¶ added in v0.20.0
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"` OmitEmpty bool `yaml:"omit_empty"` // contains filtered or unexported fields }
func (*Spec) GetContext ¶ added in v0.20.0
func (*Spec) GetContextLine ¶ added in v0.20.0
type Table ¶ added in v0.20.0
type Table struct { // Stylable via YAML Name string `yaml:"name"` Style string `yaml:"style"` Color *TableColor `yaml:"color"` Format *TableFormat `yaml:"format"` Options *TableOptions `yaml:"options"` // Not stylable via YAML Box table.BoxStyle `yaml:"-"` }
type TableColor ¶ added in v0.20.0
type TableColor struct { Border *BorderColors `yaml:"border"` Header *CellColors `yaml:"header"` Row *CellColors `yaml:"row"` }
type TableFormat ¶ added in v0.20.0
type TableOptions ¶ added in v0.20.0
type TableOutput ¶ added in v0.20.0
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"` Cwd bool `yaml:"cwd"` // contains filtered or unexported fields }
func (*Target) GetContext ¶ added in v0.20.0
func (*Target) GetContextLine ¶ added in v0.20.0
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:"-"` 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) GetContext ¶ added in v0.20.0
func (*Task) GetContextLine ¶ added in v0.20.0
type Theme ¶ added in v0.10.0
type Theme struct { Name string `yaml:"name"` Table Table `yaml:"table"` Tree Tree `yaml:"tree"` Text Text `yaml:"text"` // contains filtered or unexported fields }