mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 11:13:33 +01:00
Bug fixes: - Fix inverted pager detection logic (returned error instead of path) - Fix repo.Clone ignoring destination directory parameter - Fix sheet loading using append on pre-sized slices - Clean up partial files on copy failure - Trim whitespace from editor config Security: - Add path traversal protection for cheatsheet names Performance: - Move regex compilation outside search loop - Replace string concatenation with strings.Join in search Build: - Remove go:generate; embed config and usage as string literals - Parallelize release builds - Add fuzz testing infrastructure Testing: - Improve test coverage from 38.9% to 50.2% - Add fuzz tests for search, filter, tags, and validation Documentation: - Fix inaccurate code examples in HACKING.md - Add missing --conf and --all options to man page - Add ADRs for path traversal, env parsing, and search parallelization - Update CONTRIBUTING.md to reflect project policy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
// Package config manages application configuration and settings.
|
|
//
|
|
// The config package provides functionality to:
|
|
// - Load configuration from YAML files
|
|
// - Validate configuration values
|
|
// - Manage platform-specific configuration paths
|
|
// - Handle editor and pager settings
|
|
// - Configure colorization and formatting options
|
|
//
|
|
// # Configuration Structure
|
|
//
|
|
// The main configuration file (conf.yml) contains:
|
|
// - Editor preferences
|
|
// - Pager settings
|
|
// - Colorization options
|
|
// - Cheatpath definitions
|
|
// - Formatting preferences
|
|
//
|
|
// Example configuration:
|
|
//
|
|
// ---
|
|
// editor: vim
|
|
// colorize: true
|
|
// style: monokai
|
|
// formatter: terminal256
|
|
// pager: less -FRX
|
|
// cheatpaths:
|
|
// - name: personal
|
|
// path: ~/cheat
|
|
// tags: []
|
|
// readonly: false
|
|
// - name: community
|
|
// path: ~/cheat/.cheat
|
|
// tags: [community]
|
|
// readonly: true
|
|
//
|
|
// # Platform-Specific Paths
|
|
//
|
|
// The package automatically detects configuration paths based on the operating system:
|
|
// - Linux/Unix: $XDG_CONFIG_HOME/cheat/conf.yml or ~/.config/cheat/conf.yml
|
|
// - macOS: ~/Library/Application Support/cheat/conf.yml
|
|
// - Windows: %APPDATA%\cheat\conf.yml
|
|
//
|
|
// # Environment Variables
|
|
//
|
|
// The following environment variables are respected:
|
|
// - CHEAT_CONFIG_PATH: Override the configuration file location
|
|
// - CHEAT_USE_FZF: Enable fzf integration when set to "true"
|
|
// - EDITOR: Default editor if not specified in config
|
|
// - VISUAL: Fallback editor if EDITOR is not set
|
|
// - PAGER: Default pager if not specified in config
|
|
package config
|