output

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuditProgress

func NewAuditProgress(o Options, verbose bool) (*audit.Progress, func())

NewAuditProgress builds the audit progress reporter and a stop function. The stop function halts the background activity animator and clears the transient line; callers must invoke it before rendering final results to stdout.

func RenderAudit

func RenderAudit(o Options, version string, result *audit.Result) error

func RenderChecks

func RenderChecks(o Options, version string, results []check.Result) error

func RenderFeed

func RenderFeed(o Options, version string, result *feed.Result) error

func RenderFeedWithDashboard

func RenderFeedWithDashboard(o Options, version string, result *feed.Result) error

func RenderIDs

func RenderIDs(o Options, version string, vulns []*malindex.Vulnerability) error

func RenderSearch

func RenderSearch(o Options, version string, result *search.Result) error

func ResolveExportPath

func ResolveExportPath(outputFlag string, format ExportFormat, formats []ExportFormat) (string, error)

ResolveExportPath maps --output and --output-format to a concrete file path. When outputFlag is empty a temp file is created.

func WriteAuditCSV

func WriteAuditCSV(path string, result *audit.Result) error

WriteAuditCSV writes one row per finding to path. When there are no findings, a single summary row captures the audit verdict and scan stats.

func WriteAuditExport

func WriteAuditExport(path string, format ExportFormat, version, command string, result *audit.Result) (string, error)

WriteAuditExport writes an audit result using the requested export format.

func WriteAuditTextFile

func WriteAuditTextFile(path string, result *audit.Result) error

WriteAuditTextFile writes the human audit render without ANSI colors to path.

func WriteErrorJSON

func WriteErrorJSON(w io.Writer, version string, code int, message string) error

func WriteJSON

func WriteJSON(w io.Writer, version, command string, data interface{}) error

func WriteResultFile

func WriteResultFile(path, version, command string, data interface{}) (string, error)

WriteResultFile serializes the standard JSON envelope to path (creating parent directories) and returns the written path. It mirrors exactly what --json prints to stdout, so the file is a drop-in machine-readable copy.

func WriteSARIF

func WriteSARIF(path, toolVersion string, result *audit.Result) (string, error)

WriteSARIF renders the audit findings as a SARIF 2.1.0 report at path (creating parent directories) and returns the written path. The report is consumable by GitHub code scanning and other SARIF-aware tools.

Types

type Envelope

type Envelope struct {
	SchemaVersion string      `json:"schema_version"`
	Command       string      `json:"command"`
	DepxVersion   string      `json:"depx_version"`
	Data          interface{} `json:"data"`
}

type ExportFormat

type ExportFormat string

ExportFormat is a file export encoding for audit/github results.

const (
	ExportJSON ExportFormat = "json"
	ExportCSV  ExportFormat = "csv"
	ExportTXT  ExportFormat = "txt"
)

func ParseExportFormats

func ParseExportFormats(raw string) ([]ExportFormat, error)

ParseExportFormats parses a comma-separated export format list. An empty string defaults to json.

func (ExportFormat) ExportNoticeLabel

func (f ExportFormat) ExportNoticeLabel() string

ExportNoticeLabel is the human label used in terminal path notices.

type Options

type Options struct {
	JSON    bool
	NoColor bool
	List    bool
	Writer  io.Writer
	ErrOut  io.Writer
}

func NewOptions

func NewOptions(json, noColor bool) Options

func (Options) Color

func (o Options) Color() aurora.Aurora

Color returns the aurora colorizer configured for these options.

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

Spinner is an indeterminate activity indicator for blocking work (network or API calls) that has no granular progress to report. It animates on stderr only for interactive terminals, so it never pollutes piped output, JSON, or CI logs. A nil or disabled Spinner is safe to Start/Stop.

func NewSpinner

func NewSpinner(o Options, msg string) *Spinner

NewSpinner returns a spinner bound to o.ErrOut. It is automatically disabled (turned into a no-op) for JSON output and non-interactive writers, so callers can wrap any blocking call unconditionally.

func (*Spinner) SetMessage

func (s *Spinner) SetMessage(msg string)

SetMessage updates the spinner label while it is running.

func (*Spinner) Start

func (s *Spinner) Start()

Start begins animating after the start delay. Safe to call once; subsequent calls are ignored until Stop.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop halts the animation and clears the spinner line. Safe to call multiple times and on a spinner that never started.

Jump to

Keyboard shortcuts

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