shared

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyJQ added in v0.0.12

func ApplyJQ(data interface{}, expression string, w io.Writer, pretty bool) error

ApplyJQ executes a jq expression on data and writes results to w. Strings are output without quotes (gh-ux pattern).

func ApplyTemplate added in v0.0.12

func ApplyTemplate(data interface{}, tmpl string, w io.Writer) error

ApplyTemplate executes a Go template on data and writes results to w.

func CollectLogSnapshot

func CollectLogSnapshot(ctx context.Context, client *jenkins.Client, jobPath string, buildNumber int, maxBytes int, out io.Writer) (bool, error)

func DurationString

func DurationString(ms int64) string

func GetJQExpression added in v0.0.12

func GetJQExpression(cmd *cobra.Command) string

GetJQExpression retrieves the --jq flag value from the root command.

func GetOutputFormat added in v0.0.12

func GetOutputFormat(cmd *cobra.Command) string

GetOutputFormat returns the requested output format from --format flag. Returns empty string for default human-readable output. Note: Using --format instead of --output to avoid conflict with artifact --output/-o flag.

func GetTemplate added in v0.0.12

func GetTemplate(cmd *cobra.Command) string

GetTemplate retrieves the --template flag value from the root command.

func JenkinsClient

func JenkinsClient(cmd *cobra.Command, f *cmdutil.Factory) (*jenkins.Client, error)

func NewExitError

func NewExitError(code int, msg string) error

func PrintOutput

func PrintOutput(cmd *cobra.Command, data interface{}, human func() error) error

func ResolveContextName

func ResolveContextName(cmd *cobra.Command, cfg *config.Config) (string, error)

func StreamProgressiveLog

func StreamProgressiveLog(ctx context.Context, client *jenkins.Client, jobPath string, buildNumber int, interval time.Duration, out io.Writer) error

func ValidateOutputFlags added in v0.0.13

func ValidateOutputFlags(cmd *cobra.Command) error

ValidateOutputFlags enforces output flag combinations and supported formats.

func WantsJQ added in v0.0.12

func WantsJQ(cmd *cobra.Command) bool

WantsJQ returns true if --jq flag is set with a non-empty expression.

func WantsJSON

func WantsJSON(cmd *cobra.Command) bool

func WantsQuiet added in v0.0.12

func WantsQuiet(cmd *cobra.Command) bool

WantsQuiet returns true if --quiet/-q flag is set or JK_QUIET env var is present. Currently supported by: run start, run rerun. Other commands (view, cancel, ls) do not implement quiet mode as they primarily output structured data where --json is more appropriate.

func WantsTemplate added in v0.0.12

func WantsTemplate(cmd *cobra.Command) bool

WantsTemplate returns true if --template flag is set.

func WantsYAML

func WantsYAML(cmd *cobra.Command) bool

Types

type TestCase

type TestCase struct {
	ClassName string  `json:"className"`
	Name      string  `json:"name"`
	Status    string  `json:"status"`
	Duration  float64 `json:"duration"`
}

type TestReport

type TestReport struct {
	TotalCount int         `json:"totalCount"`
	FailCount  int         `json:"failCount"`
	SkipCount  int         `json:"skipCount"`
	Suites     []TestSuite `json:"suites"`
}

func FetchTestReport

func FetchTestReport(client *jenkins.Client, jobPath string, buildNumber int64) (*TestReport, error)

type TestSuite

type TestSuite struct {
	Name  string     `json:"name"`
	Cases []TestCase `json:"cases"`
}

Jump to

Keyboard shortcuts

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