Documentation
¶
Overview ¶
Package cli provides the command-line interface for confvis.
Index ¶
- func Execute()
- func GetConfigFile() string
- func ParseInputFormat(s string) (confidence.Format, error)
- func ParseRepoFromEnv(currentOwner, currentRepo string, env *checks.GitHubEnv) (owner, repo string)
- type AggregateDeps
- type BaselineDeps
- type CheckGitHubDeps
- type CommentGitHubDeps
- type FetchDeps
- type FileSystem
- type GaugeDeps
- type GenerateDeps
- type ReportLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigFile ¶
func GetConfigFile() string
GetConfigFile returns the config file being used, if any.
func ParseInputFormat ¶ added in v1.0.0
func ParseInputFormat(s string) (confidence.Format, error)
ParseInputFormat converts a string input format to confidence.Format.
Types ¶
type AggregateDeps ¶
type AggregateDeps struct {
FS FileSystem
Stderr io.Writer
Verbose bool
Quiet bool
ExitFunc func(int)
Configs []string
Output string
Dark bool
FailUnder int
BadgeType string
Icon string
Label string
EmitJSON string
Fragment bool
}
AggregateDeps contains dependencies for the aggregate command.
type BaselineDeps ¶
type BaselineDeps struct {
FS FileSystem
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Verbose bool
Quiet bool
Config string
Ref string
File string
Format string
DryRun bool
IsGitRepo func() bool
GitRefReader func(string) (*baseline.Baseline, error)
GitRefWriter func(string, *baseline.Baseline) error
FileReader func(string) (*baseline.Baseline, error)
FileWriter func(string, *baseline.Baseline) error
}
BaselineDeps contains dependencies for baseline commands.
type CheckGitHubDeps ¶
type CheckGitHubDeps struct {
FS FileSystem
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Verbose bool
Quiet bool
Config string
Owner string
Repo string
SHA string
Name string
Token string
APIURL string
AutoDetect bool
DryRun bool
Timeout time.Duration
// Functions for testability
CreateCheck func(ctx context.Context, client *checks.GitHubClient, report *confidence.Report,
opts checks.CreateCheckOptions) (*checks.CheckRunResponse, error)
LoadGitHubEnv func() (*checks.GitHubEnv, error)
}
CheckGitHubDeps contains dependencies for the check github command.
type CommentGitHubDeps ¶ added in v1.0.0
type CommentGitHubDeps struct {
FS FileSystem
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Verbose bool
Quiet bool
Config string
Owner string
Repo string
PR int
Token string
APIURL string
Mode string
AutoDetect bool
DryRun bool
Timeout time.Duration
// Functions for testability
FindComment func(ctx context.Context, client *checks.GitHubClient, opts checks.CommentOptions) (*checks.CommentResponse, error)
PostComment func(ctx context.Context, client *checks.GitHubClient, opts checks.CommentOptions, body string) (*checks.CommentResponse, error)
UpdateComment func(ctx context.Context, client *checks.GitHubClient, opts checks.CommentOptions, commentID int64, body string) (*checks.CommentResponse, error)
DeleteComment func(ctx context.Context, client *checks.GitHubClient, opts checks.CommentOptions, commentID int64) error
FindAllComments func(ctx context.Context, client *checks.GitHubClient, opts checks.CommentOptions) ([]checks.CommentResponse, error)
LoadGitHubEnvPR func() (*checks.GitHubEnv, int, error)
}
CommentGitHubDeps contains dependencies for the comment github command.
type FetchDeps ¶
type FetchDeps struct {
FS FileSystem
Stdout io.Writer
Stderr io.Writer
Verbose bool
Quiet bool
SourceGetter func(string) sources.Source
SourceName string
URL string
Project string
Token string
Branch string
Title string
Threshold int
Timeout int
Output string
Extra map[string]string
}
FetchDeps contains dependencies for the fetch command.
type FileSystem ¶
type FileSystem interface {
// Create creates or truncates the named file.
Create(name string) (io.WriteCloser, error)
// MkdirAll creates a directory named path, along with any necessary parents.
MkdirAll(path string, perm os.FileMode) error
// Open opens the named file for reading.
Open(name string) (io.ReadCloser, error)
// ReadFile reads the named file and returns the contents.
ReadFile(name string) ([]byte, error)
// Glob returns the names of all files matching pattern.
Glob(pattern string) ([]string, error)
}
FileSystem abstracts file operations for testability.
var DefaultFileSystem FileSystem = osFS{}
DefaultFileSystem is the default FileSystem implementation using real OS calls.
type GaugeDeps ¶
type GaugeDeps struct {
FS FileSystem
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Verbose bool
Quiet bool
ExitFunc func(int)
HistoryReader func(string) (*history.History, error)
HistoryAppender func(string, history.Entry) error
GitRefReader func(string) (*history.History, error)
GitRefAppender func(string, history.Entry) error
BaselineGitRefReader func(string) (*baseline.Baseline, error)
BaselineFileReader func(string) (*baseline.Baseline, error)
IsGitRepo func() bool
Config string
Output string
Format string
Style string
BadgeType string
Label string
Icon string
InputFormat string
Compare string
HistoryFile string
HistoryRef string
BaselineRef string
BaselineFile string
FactorThresholds map[string]int
Width int
Height int
FailUnder int
GreenAbove int
YellowAbove int
HistoryCount int
Dark bool
FailOnRegression bool
HistoryAuto bool
CompareBaseline bool
EmitJSON string
}
GaugeDeps contains dependencies for the gauge command.
type GenerateDeps ¶
type GenerateDeps struct {
FS FileSystem
Stdin io.Reader
Stderr io.Writer
Verbose bool
Quiet bool
ExitFunc func(int)
Config string
Output string
InputFormat string
Dark bool
FailUnder int
}
GenerateDeps contains dependencies for the generate command.
type ReportLoader ¶ added in v1.0.0
type ReportLoader struct {
FS FileSystem
Stdin io.Reader
Config string
Format confidence.Format // Optional: FormatAuto (default), FormatJSON, FormatYAML
}
ReportLoader loads confidence reports from stdin or files.
func (*ReportLoader) LoadReport ¶ added in v1.0.0
func (l *ReportLoader) LoadReport() (*confidence.Report, error)
LoadReport loads a confidence report from stdin or file path.