cli

package
v0.0.0-...-5cac315 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Report Report `kong:"cmd,help='Analyze coverage file(s) and create a coverage report.'"`

	Log struct {
		Level slog.Level `enum:"DEBUG,INFO,WARN,ERROR" default:"INFO" help:"Set the app logging level."`
	} `embed:"" prefix:"log-"`
	Version kong.VersionFlag `kong:"help='Output fcov version and exit.'"`
	// contains filtered or unexported fields
}

CLI is the command line interface of fcov.

func New

func New(version string) (*CLI, error)

New initializes the command-line interface.

func (*CLI) Command

func (c *CLI) Command() string

Command returns the full path of the executed command.

func (*CLI) Execute

func (c *CLI) Execute(appCtx *actx.Context) error

Execute starts the command execution. Parse must be called before this method.

func (*CLI) Parse

func (c *CLI) Parse(args []string) error

Parse the given command line arguments. This method must be called before Execute.

type Output

type Output struct {
	Format   report.Format
	Filename string
}

Output is a destination the report should be written to. If Filename is empty, the report will be written to stdout.

type OutputOption

type OutputOption []Output

OutputOption is a custom type that parses the output option.

func (*OutputOption) UnmarshalText

func (o *OutputOption) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for OutputOption.

type Report

type Report struct {
	Files             []string         `arg:"" help:"One or more coverage files."` // not using 'existingfile' modifier since it makes it difficult to test with an in-memory FS
	Filter            []string         ``                                          /* 210-byte string literal not displayed */
	FilterOutput      []string         ``                                          /* 146-byte string literal not displayed */
	FilterOutputFile  string           ``                                          /* 157-byte string literal not displayed */
	NestFiles         bool             `help:"Nest files under packages when rendering to text or Markdown. " default:"true" negatable:""`
	Output            OutputOption     `` /* 357-byte string literal not displayed */
	Thresholds        ThresholdsOption `help:"Lower and upper threshold percentages for badge and health indicators. " default:"50,75"`
	TrimPackagePrefix string           `help:"Trim this prefix string from the package path in the output. "`
}

Report is the fcov report command.

func (*Report) Run

func (s *Report) Run(appCtx *actx.Context) error

Run the fcov report command. TODO: This currently assumes Go coverage processing. Either correctly infer so, or add a CLI flag to use Go mode reporting.

type ThresholdsOption

type ThresholdsOption struct {
	Lower, Upper float64
}

ThresholdsOption is a custom type that parses the thresholds option.

func (*ThresholdsOption) UnmarshalText

func (o *ThresholdsOption) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for ThresholdsOption.

Jump to

Keyboard shortcuts

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