internal

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package internal provides internal utilities for the Grant CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigLocations added in v0.3.0

func DefaultConfigLocations() []string

DefaultConfigLocations returns the default locations to look for config files following the XDG Base Directory Specification

func DisplaySummaryTree added in v0.3.0

func DisplaySummaryTree(total int, denied int, allowed int, ignored int, unlicensed int)

DisplaySummaryTree displays the summary in tree format

func GetResolvedConfigPath added in v0.3.1

func GetResolvedConfigPath() string

GetResolvedConfigPath returns the path of the config file that was actually loaded

func IsTerminalError added in v0.3.0

func IsTerminalError() bool

IsTerminalError returns true if stderr is a terminal (not piped or redirected)

func IsTerminalInput added in v0.3.0

func IsTerminalInput() bool

IsTerminalInput returns true if stdin is a terminal (not piped or redirected)

func IsTerminalOutput added in v0.3.0

func IsTerminalOutput() bool

IsTerminalOutput returns true if stdout is a terminal (not piped or redirected)

func SaveDefaultConfig added in v0.3.0

func SaveDefaultConfig(path string) error

SaveDefaultConfig creates a default configuration file

func ValidateConfig added in v0.3.0

func ValidateConfig(config *Config) error

ValidateConfig validates the configuration

Types

type Config added in v0.3.0

type Config struct {
	ConfigFile   string
	OutputFormat string
	Quiet        bool
	Verbose      bool

	// Policy configuration
	Policy *grant.Policy
}

Config represents the CLI configuration

func LoadConfig added in v0.3.0

func LoadConfig(configFile string) (*Config, error)

LoadConfig loads configuration from various sources

type Output added in v0.3.0

type Output struct{}

Output handles different output formats for grant results

func NewOutput added in v0.3.0

func NewOutput() *Output

NewOutput creates a new Output instance

func (*Output) OutputJSON added in v0.3.0

func (o *Output) OutputJSON(result *grant.RunResponse, outputFile string) error

OutputJSON outputs the result as JSON

func (*Output) OutputListTable added in v0.3.0

func (o *Output) OutputListTable(result *grant.RunResponse) error

OutputListTable outputs the result as a list-specific table format with progress and aggregated licenses

func (*Output) OutputQuiet added in v0.3.0

func (o *Output) OutputQuiet(result *grant.RunResponse) error

OutputQuiet outputs minimal information for quiet mode

func (*Output) OutputSummaryOnly added in v0.3.0

func (o *Output) OutputSummaryOnly(result *grant.RunResponse) error

OutputSummaryOnly outputs just the summary information

func (*Output) OutputTable added in v0.3.0

func (o *Output) OutputTable(result *grant.RunResponse) error

OutputTable outputs the result as a formatted table

type ProgressDisplay added in v0.3.0

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

ProgressDisplay manages the progress output for grant operations

func DisplayScanProgress added in v0.3.0

func DisplayScanProgress(source string, sourceType string) *ProgressDisplay

DisplayScanProgress displays progress for scanning operations similar to grype/syft

func NewProgressDisplay added in v0.3.0

func NewProgressDisplay(verbose bool) *ProgressDisplay

NewProgressDisplay creates a new progress display

func (*ProgressDisplay) AddStep added in v0.3.0

func (p *ProgressDisplay) AddStep(title string)

AddStep adds a new step to the progress display

func (*ProgressDisplay) CompleteStep added in v0.3.0

func (p *ProgressDisplay) CompleteStep(index int)

CompleteStep marks a step as complete

func (*ProgressDisplay) Display added in v0.3.0

func (p *ProgressDisplay) Display()

Display shows the current progress

func (*ProgressDisplay) SetSubSteps added in v0.3.0

func (p *ProgressDisplay) SetSubSteps(index int, subSteps []SubStep)

SetSubSteps sets the sub-steps for a given step

func (*ProgressDisplay) UpdateCatalogedContents added in v0.3.0

func (p *ProgressDisplay) UpdateCatalogedContents(packages int, licenses int, files int)

UpdateCatalogedContents updates the cataloged contents with actual values

func (*ProgressDisplay) UpdateStep added in v0.3.0

func (p *ProgressDisplay) UpdateStep(index int, status StepStatus)

UpdateStep updates the status of a step

type ProgressStep added in v0.3.0

type ProgressStep struct {
	Title       string
	Status      StepStatus
	SubSteps    []SubStep
	ShowSubTree bool
}

ProgressStep represents a single step in the progress display

type RealtimeUI added in v0.3.0

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

RealtimeUI provides a simpler real-time progress display

func NewRealtimeUI added in v0.3.0

func NewRealtimeUI(quiet bool) *RealtimeUI

NewRealtimeUI creates a new real-time UI

func (*RealtimeUI) ShowCatalogedContents added in v0.3.0

func (ui *RealtimeUI) ShowCatalogedContents(packages int, licenses int, files int)

ShowCatalogedContents shows the cataloged contents in tree format

func (*RealtimeUI) ShowComplianceResult added in v0.3.0

func (ui *RealtimeUI) ShowComplianceResult(status string)

ShowComplianceResult shows the compliance check result

func (*RealtimeUI) ShowLoadingProgress added in v0.3.0

func (ui *RealtimeUI) ShowLoadingProgress(source string)

ShowLoadingProgress shows initial loading message

func (*RealtimeUI) ShowScanComplete added in v0.3.0

func (ui *RealtimeUI) ShowScanComplete(source string, sourceType string)

ShowScanComplete shows completed scan status

func (*RealtimeUI) ShowScanningSteps added in v0.3.0

func (ui *RealtimeUI) ShowScanningSteps(source string, sourceType string, packages int, licenses int, files int)

ShowScanningSteps shows all the scanning steps (deprecated - kept for compatibility)

type StepStatus added in v0.3.0

type StepStatus int

StepStatus represents the status of a progress step

const (
	StatusPending StepStatus = iota
	StatusRunning
	StatusComplete
	StatusError
)

type SubStep added in v0.3.0

type SubStep struct {
	Icon  string
	Title string
	Value string
}

SubStep represents a sub-step with tree display

Jump to

Keyboard shortcuts

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