confile

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists() bool

Exists checks whether or not the preferred config file exists or not. It returns true if the file exists, and false if the file doesn't exist.

Types

type File

type File struct {
	Project *Project          `yaml:"project"`
	Envs    map[string]string `yaml:"envs,omitempty"`
	Steps   map[string]*Step  `yaml:"steps"`
	Vars    *vars.Vars        `yaml:"-"`
}

File represents the build options for a project

func ParseFromFile

func ParseFromFile() (*File, error)

ParseFromFile reads an Forge config file from the from the curent directory. A File with the populated values is returned and any errors encountered while trying to read the file.

func (*File) Fmt

func (f *File) Fmt() error

Fmt marshals the config file struct into yaml and overwrites the original config file in the current directory. It returns any errors it encounters.

type Project

type Project struct {
	Name string `yaml:"name"`
}

Project represents metadata about the project being built that can be included in the config file.

type Step

type Step struct {
	Cmd   string            `yaml:"cmd,omitempty"`
	Cmds  []string          `yaml:"cmds,omitempty"`
	Envs  map[string]string `yaml:"envs,omitempty"`
	Help  string            `yaml:"help,omitempty"`
	Post  []string          `yaml:"post,omitempty"`
	Pre   []string          `yaml:"pre,omitempty"`
	Steps []string          `yaml:"steps,omitempty"`
	// contains filtered or unexported fields
}

Step represents details of single step to be executed by the cli.

func (*Step) Execute

func (s *Step) Execute(allSteps map[string]*Step, projectEnvs map[string]string, vars *vars.Vars) error

Execute runs the command that is specified for the step. It returns the output of the command and any errors it encounters.

Jump to

Keyboard shortcuts

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