cmd

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertParserLinks(parserLinks []parser.Link) []checker.Link

ConvertParserLinks converts a slice of parser.Link to checker.Link. This bridges the gap between the parser and checker packages.

func CountUniqueURLs added in v0.1.1

func CountUniqueURLs(links []checker.Link) int

CountUniqueURLs returns the number of unique URLs in a slice of checker.Link. This is useful for displaying progress information and deduplication stats.

func CreateFilter added in v0.1.1

func CreateFilter(opts FilterOptions) (*filter.Filter, error)

CreateFilter builds a URL filter from config file and CLI flags. If noConfig is true, the .gonerc.yaml file will not be loaded. CLI flags are merged additively with config file settings. Returns nil if no filter rules are defined.

func CreateFilterWithConfig added in v0.1.3

func CreateFilterWithConfig(cfg *config.Config, cliDomains, cliPatterns, cliRegex []string) (*filter.Filter, error)

CreateFilterWithConfig builds a URL filter using a pre-loaded config. CLI flags are merged additively with the config settings. Returns nil if no filter rules are defined.

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func FilterParserLinks(parserLinks []parser.Link, urlFilter *filter.Filter) []checker.Link

FilterParserLinks applies a URL filter to parser links and returns checker links. Links that match the filter are excluded from the result. Returns all links converted to checker.Link if urlFilter is nil.

func FilterResultsAlive added in v0.1.1

func FilterResultsAlive(results []checker.Result) []checker.Result

FilterResultsAlive returns only alive results. Pre-allocates slice capacity - alive is typically the majority (~70-80%).

func FilterResultsDead added in v0.1.1

func FilterResultsDead(results []checker.Result) []checker.Result

FilterResultsDead returns results that are dead or errored. Pre-allocates slice capacity based on expected ratio (~5-15% dead).

func FilterResultsDuplicates added in v0.1.1

func FilterResultsDuplicates(results []checker.Result) []checker.Result

FilterResultsDuplicates returns only duplicate results. Pre-allocates slice capacity based on expected ratio (~10% duplicates).

func FilterResultsWarnings added in v0.1.1

func FilterResultsWarnings(results []checker.Result) []checker.Result

FilterResultsWarnings returns results with warning status (redirect or blocked). Pre-allocates slice capacity based on expected ratio (~10-30% warnings).

func SetVersion

func SetVersion(v string)

SetVersion sets the version string (called from main).

Types

type FilterOptions added in v0.1.1

type FilterOptions struct {
	Domains  []string // Domains to ignore (includes subdomains)
	Patterns []string // Glob patterns to ignore
	Regex    []string // Regex patterns to ignore
	NoConfig bool     // Skip loading .gonerc.yaml config file
}

FilterOptions holds the configuration for creating a URL filter. This struct consolidates the filter-related flags used across commands.

type LoadedConfig added in v0.1.3

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

LoadedConfig wraps a loaded configuration and provides helper methods for getting effective values that respect CLI overrides.

func LoadConfig added in v0.1.3

func LoadConfig(noConfig bool) (*LoadedConfig, error)

LoadConfig loads the configuration file unless noConfig is true. Returns an error if the config file exists but is invalid.

func (*LoadedConfig) BuildCheckerOptions added in v0.1.3

func (lc *LoadedConfig) BuildCheckerOptions(cliConcurrency, cliTimeout, cliRetries int) checker.Options

BuildCheckerOptions creates checker.Options from config and CLI values.

func (*LoadedConfig) BuildScanOptions added in v0.1.3

func (lc *LoadedConfig) BuildScanOptions(path string, cliTypes, cliDefaultTypes []string) scanner.ScanOptions

BuildScanOptions creates scanner.ScanOptions from config and path.

func (*LoadedConfig) Config added in v0.1.3

func (lc *LoadedConfig) Config() *config.Config

Config returns the underlying config for direct access.

func (*LoadedConfig) GetConcurrency added in v0.1.3

func (lc *LoadedConfig) GetConcurrency(cliValue, defaultValue int) int

GetConcurrency returns the effective concurrency. CLI overrides config if it differs from the default.

func (*LoadedConfig) GetOutputFormat added in v0.1.3

func (lc *LoadedConfig) GetOutputFormat(cliValue string) string

GetOutputFormat returns the effective output format. CLI overrides config if set.

func (*LoadedConfig) GetRetries added in v0.1.3

func (lc *LoadedConfig) GetRetries(cliValue, defaultValue int) int

GetRetries returns the effective retry count. CLI overrides config if it differs from the default.

func (*LoadedConfig) GetScanOptions added in v0.1.3

func (lc *LoadedConfig) GetScanOptions() (include, exclude []string)

GetScanOptions returns scanner include/exclude patterns from config.

func (*LoadedConfig) GetShowAlive added in v0.1.3

func (lc *LoadedConfig) GetShowAlive(cliValue bool) bool

GetShowAlive returns the effective showAlive setting. CLI true overrides config.

func (*LoadedConfig) GetShowDead added in v0.1.3

func (lc *LoadedConfig) GetShowDead(cliValue bool) bool

GetShowDead returns the effective showDead setting. CLI true overrides config. Defaults to true if not set.

func (*LoadedConfig) GetShowStats added in v0.1.3

func (lc *LoadedConfig) GetShowStats(cliValue bool) bool

GetShowStats returns the effective showStats setting. CLI true overrides config.

func (*LoadedConfig) GetShowWarnings added in v0.1.3

func (lc *LoadedConfig) GetShowWarnings(cliValue bool) bool

GetShowWarnings returns the effective showWarnings setting. CLI true overrides config. Defaults to true if not set.

func (*LoadedConfig) GetStrict added in v0.1.3

func (lc *LoadedConfig) GetStrict(cliValue bool) bool

GetStrict returns the effective strict mode setting. CLI true overrides config.

func (*LoadedConfig) GetTimeout added in v0.1.3

func (lc *LoadedConfig) GetTimeout(cliValue, defaultValue int) int

GetTimeout returns the effective timeout in seconds. CLI overrides config if it differs from the default.

func (*LoadedConfig) GetTypes added in v0.1.3

func (lc *LoadedConfig) GetTypes(cliTypes, cliDefault []string) []string

GetTypes returns the effective file types. CLI types override config if they differ from the CLI default.

Jump to

Keyboard shortcuts

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