dao

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version               = "dev"
	DEFAULT_SHELL         = "sh -c"
	ACCEPTABLE_FILE_NAMES = []string{"mani.yaml", "mani.yml", ".mani", ".mani.yaml", ".mani.yml"}
)

Functions

func CloneRepo

func CloneRepo(configPath string, project Project) error

func ExecCmd

func ExecCmd(
	configPath string,
	shell string,
	project Project,
	cmdString string,
	dryRun bool,
) (string, error)

func GetAbsolutePath

func GetAbsolutePath(configPath string, projectPath string, projectName string) (string, error)

Get the absolute path to a project Need to support following path types:

lala/land
./lala/land
../lala/land
/lala/land
$HOME/lala/land
~/lala/land
~root/lala/land

func GetClosestConfigFile

func GetClosestConfigFile() (string, error)

func GetProjectRelPath

func GetProjectRelPath(configPath string, path string) (string, error)

func ProjectInSlice

func ProjectInSlice(name string, list []Project) bool

func UpdateProjectsToGitignore

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

Types

type Command

type Command struct {
	Name        string            `yaml:"name"`
	Description string            `yaml:"description"`
	Args        map[string]string `yaml:"args"`
	Shell       string            `yaml:"shell"`
	Command     string            `yaml:"command"`
}

func (Command) GetUserArguments

func (c Command) GetUserArguments() []string

func (Command) GetValue

func (c Command) GetValue(key string) string

func (Command) ParseUserArguments

func (c Command) ParseUserArguments(userArguments []string) map[string]string

func (Command) RunCommand

func (c Command) RunCommand(
	configPath string,
	shell string,
	project Project,
	userArguments []string,
	dryRun bool,
) (string, error)

type Config

type Config struct {
	Path string

	Shell    string    `yaml:"shell"`
	Projects []Project `yaml:"projects"`
	Commands []Command `yaml:"commands"`
}

func ReadConfig

func ReadConfig(cfgName string) (Config, error)

func (Config) CloneRepos

func (c Config) CloneRepos()

func (Config) EditFile

func (c Config) EditFile()

func (Config) FilterProjects

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

func (Config) GetCommand

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

func (Config) GetCommandNames

func (c Config) GetCommandNames() []string

func (Config) GetCommands

func (c Config) GetCommands() []string

func (Config) GetCommandsByNames

func (c Config) GetCommandsByNames(names []string) []Command

func (Config) GetCwdProject

func (c Config) GetCwdProject() Project

func (Config) GetProjectNames

func (c Config) GetProjectNames() []string

func (Config) GetProjectUrls

func (c Config) GetProjectUrls() []string

func (Config) GetProjects

func (c Config) GetProjects(flagProjects []string) []Project

func (Config) GetProjectsByName

func (c Config) GetProjectsByName(names []string) []Project

func (Config) GetProjectsByTags

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

Projects must have all tags to match. For instance, if --tags frontend,backend is passed, then a project must have both tags.

func (Config) GetTags

func (c Config) GetTags() []string

func (Config) GetTagsByProject

func (c Config) GetTagsByProject(projectNames []string) []string

type Project

type Project struct {
	Name        string   `yaml:"name"`
	Path        string   `yaml:"path"`
	Description string   `yaml:"description"`
	Url         string   `yaml:"url"`
	Tags        []string `yaml:"tags"`

	RelPath string
}

func FindVCSystems

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

func GetIntersectProjects

func GetIntersectProjects(a []Project, b []Project) []Project

func GetUnionProjects

func GetUnionProjects(a []Project, b []Project, c Project) []Project

func (Project) GetValue

func (p Project) GetValue(key string) string

type ProjectOutput

type ProjectOutput struct {
	ProjectName string
	Output      string
}

Jump to

Keyboard shortcuts

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