Documentation
¶
Index ¶
- func FiltersConfigPath() string
- func LoadCustomFilters() map[string]CustomFilter
- func LoadCustomFiltersFrom(path string) map[string]CustomFilter
- func LoadCustomFiltersWithLocal(cwd string) map[string]CustomFilter
- func ParseCustomFilters(data []byte) map[string]CustomFilter
- func Path() string
- type Config
- type CustomFilter
- type CustomFiltersConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FiltersConfigPath ¶ added in v1.6.0
func FiltersConfigPath() string
FiltersConfigPath returns the path to the custom filters file.
func LoadCustomFilters ¶ added in v1.6.0
func LoadCustomFilters() map[string]CustomFilter
LoadCustomFilters reads the custom filters config file. Returns an empty map if the file doesn't exist or can't be parsed.
func LoadCustomFiltersFrom ¶ added in v1.6.0
func LoadCustomFiltersFrom(path string) map[string]CustomFilter
LoadCustomFiltersFrom reads custom filters from a specific path.
func LoadCustomFiltersWithLocal ¶ added in v1.6.0
func LoadCustomFiltersWithLocal(cwd string) map[string]CustomFilter
LoadCustomFiltersWithLocal loads global custom filters, then overlays a local .chop-filters.yml from the given directory (if it exists). Local filters are merged on top of global ones (local wins on conflict).
func ParseCustomFilters ¶ added in v1.6.0
func ParseCustomFilters(data []byte) map[string]CustomFilter
ParseCustomFilters parses YAML bytes into a custom filters map.
Types ¶
type Config ¶
type Config struct {
Disabled []string
}
Config holds user preferences loaded from ~/.config/chop/config.yml.
func Load ¶
func Load() Config
Load reads the config file and returns a Config. Returns defaults if the file doesn't exist or can't be parsed.
func LoadWithLocal ¶ added in v1.1.0
LoadWithLocal loads the global config, then overlays a local .chop.yml from the given directory (if it exists). The local disabled list fully replaces the global one.
func (Config) IsDisabled ¶
IsDisabled returns true if the given base command (and optional subcommand) matches an entry in the disabled list.
Matching rules:
- "git" disables all git subcommands
- "git diff" disables only "git diff"
Call with: IsDisabled("git", "diff") or IsDisabled("git")
type CustomFilter ¶ added in v1.6.0
type CustomFilter struct {
Keep []string `yaml:"keep"` // regex patterns - only lines matching at least one are kept
Drop []string `yaml:"drop"` // regex patterns - lines matching any are removed
Head int `yaml:"head"` // keep only first N lines (applied after keep/drop)
Tail int `yaml:"tail"` // keep only last N lines (applied after keep/drop)
Exec string `yaml:"exec"` // external script: pipe output through this command
}
CustomFilter defines a user-configured output filter for a specific command.
func LookupCustomFilter ¶ added in v1.6.0
func LookupCustomFilter(filters map[string]CustomFilter, command string, args []string) *CustomFilter
LookupCustomFilter finds a custom filter for the given command and args. It checks "command subcommand" first, then falls back to "command".
type CustomFiltersConfig ¶ added in v1.6.0
type CustomFiltersConfig struct {
Filters map[string]CustomFilter `yaml:"filters"`
}
CustomFiltersConfig holds the full filters.yml content.