Documentation
¶
Index ¶
Constants ¶
const ( // OnlyAll includes all repositories, regardless of state. OnlyAll OnlyFilter = "all" // OnlyDirty includes repositories that have uncommitted changes or are // ahead/behind their upstream. OnlyDirty = "dirty" // OnlyUncommitted includes repositories with uncommitted files. OnlyUncommitted = "uncommitted" // OnlyUnpushed includes repositories with local commits not pushed upstream. OnlyUnpushed = "unpushed" // OnlyUnpulled includes repositories with upstream commits not yet pulled. OnlyUnpulled = "unpulled" )
const ( DefaultConfigDir = "/.config/reposcan/" DefaultConfigToml = "config.toml" )
Default configuration locations under the user's home directory.
Variables ¶
This section is empty.
Functions ¶
func WriteToFile ¶
WriteToFile serializes config to TOML and writes it to path. Parent directories are created if necessary.
Types ¶
type Config ¶
type Config struct {
Roots []string `json:"roots,omitempty"`
DirIgnore []string `json:"dirignore,omitempty"`
Only OnlyFilter `json:"only,omitempty"`
// Write report json to path, ignored if empty
JsonOutputPath string `json:"jsonOutputPath,omitempty"`
// Print json on std out,
Output OutputFormat `json:"output"`
// Max git checker workers
MaxWorkers int `json:"maxWorkers"`
Version int `json:"version"`
}
Config holds all runtime options used by reposcan. Values may come from a config file and/or be overridden by CLI flags.
func CreateOrReadConfigs ¶
CreateOrReadConfigs loads configuration from the user's home directory. If the config file does not exist, it writes a Defaults() config to disk and returns that default configuration.
type OnlyFilter ¶
type OnlyFilter string
OnlyFilter controls which repositories are included in results based on their cleanliness and remote sync state.
func CreateOnlyFilter ¶
func CreateOnlyFilter(s string) (OnlyFilter, error)
CreateOnlyFilter parses s into an OnlyFilter, returning an error for unrecognized values. Matching is case-insensitive and trims whitespace.
func (OnlyFilter) IsValid ¶
func (f OnlyFilter) IsValid() bool
IsValid reports whether f is a recognized OnlyFilter value.
type OutputFormat ¶
type OutputFormat string
OutputFormat controls how scan results are rendered.
const ( // OutputJson prints a JSON object representing a ScanReport to stdout. OutputJson OutputFormat = "json" // OutputTable prints a human-readable table to stdout. OutputTable OutputFormat = "table" // OutputNone suppresses all stdout output. OutputNone OutputFormat = "none" )
func CreateOutputFormat ¶
func CreateOutputFormat(s string) (OutputFormat, error)
CreateOutputFormat parses s into an OutputFormat, returning an error for unrecognized values. Matching is case-insensitive and trims whitespace.
func (OutputFormat) IsValid ¶
func (o OutputFormat) IsValid() bool
IsValid reports whether o is a recognized OutputFormat value.
type Paths ¶
Paths contains resolved file-system locations for configuration.
func DefaultPaths ¶
func DefaultPaths() Paths
DefaultPaths returns the default config directory and file path relative to the user's home directory.
type Source ¶
type Source string
Source is a descriptor you might use later when merging; not required today.
type ValidationResult ¶
ValidationResult aggregates validation warnings and errors discovered while checking a Config value.
func Validate ¶
func Validate(config Config) ValidationResult
Validate checks a Config for common issues such as non-existent roots, invalid enum values, and unusable output paths.
func (*ValidationResult) IsValid ¶
func (v *ValidationResult) IsValid() bool
IsValid reports whether the configuration contains any errors. It returns true when there is at least one error.
func (ValidationResult) Print ¶
func (v ValidationResult) Print()
Print writes warnings and errors to stdout using the stdout renderer.