table

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package table provides a human-readable table output formatter for terminal display.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	// ShowRaw, when true, appends a trailing RAW column holding the unredacted
	// secret value. When false, no RAW column is emitted at all.
	ShowRaw bool

	// ColorEnabled, when true, wraps severity text with ANSI color codes.
	// Should be enabled only when writing to a terminal, not to files.
	ColorEnabled bool
}

Formatter outputs findings as a human-readable table for terminal display.

func (*Formatter) FileExtension

func (f *Formatter) FileExtension() string

FileExtension returns the text file extension.

func (*Formatter) Format

func (f *Formatter) Format(w io.Writer, findings []finding.Finding) error

Format writes findings as a formatted table to the given writer. Columns: SEVERITY | DETECTOR | FILE | LINE | REDACTED | STATUS | REMEDIATION When ShowRaw is true, a trailing RAW column is appended. Its value is a reversible Go-quoted string so arbitrary secret bytes cannot inject terminal controls and can still be recovered exactly with strconv.Unquote. A summary line is appended at the bottom.

DetectorID, FilePath, and Redacted are attacker-influenced (a malicious file name or a permissive custom detector rule can embed arbitrary bytes) and are sanitized via output.SanitizeForDisplay before reaching this writer, which is a real terminal when the CLI is run interactively. This strips control/ANSI-escape bytes so a crafted finding cannot inject terminal escape sequences into the operator's session.

Jump to

Keyboard shortcuts

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