Documentation
¶
Overview ¶
Package internal provides internal utilities for the Grant CLI.
Index ¶
- func DefaultConfigLocations() []string
- func DisplaySummaryTree(total int, denied int, allowed int, ignored int, unlicensed int)
- func GetResolvedConfigPath() string
- func IsTerminalError() bool
- func IsTerminalInput() bool
- func IsTerminalOutput() bool
- func SaveDefaultConfig(path string) error
- func ValidateConfig(config *Config) error
- type Config
- type Output
- func (o *Output) OutputJSON(result *grant.RunResponse, outputFile string) error
- func (o *Output) OutputListTable(result *grant.RunResponse) error
- func (o *Output) OutputQuiet(result *grant.RunResponse) error
- func (o *Output) OutputSummaryOnly(result *grant.RunResponse) error
- func (o *Output) OutputTable(result *grant.RunResponse) error
- type ProgressDisplay
- func (p *ProgressDisplay) AddStep(title string)
- func (p *ProgressDisplay) CompleteStep(index int)
- func (p *ProgressDisplay) Display()
- func (p *ProgressDisplay) SetSubSteps(index int, subSteps []SubStep)
- func (p *ProgressDisplay) UpdateCatalogedContents(packages int, licenses int, files int)
- func (p *ProgressDisplay) UpdateStep(index int, status StepStatus)
- type ProgressStep
- type RealtimeUI
- func (ui *RealtimeUI) ShowCatalogedContents(packages int, licenses int, files int)
- func (ui *RealtimeUI) ShowComplianceResult(status string)
- func (ui *RealtimeUI) ShowLoadingProgress(source string)
- func (ui *RealtimeUI) ShowScanComplete(source string, sourceType string)
- func (ui *RealtimeUI) ShowScanningSteps(source string, sourceType string, packages int, licenses int, files int)
- type StepStatus
- type SubStep
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
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
SaveDefaultConfig creates a default configuration file
func ValidateConfig ¶ added in v0.3.0
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
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 (*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 )