config

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppConfig Config
	AppState  State
)

Functions

func InitConfig added in v1.6.0

func InitConfig(cfgFile string)

InitConfig reads in config file and ENV variables if set.

func LoadConfig

func LoadConfig(profile string)

LoadConfig initializes the config with optional profile selection

func LoadState

func LoadState() error

func SaveState

func SaveState() error

Types

type Config

type Config struct {
	Author           string   `mapstructure:"author"`
	DormantThreshold int      `mapstructure:"dormant_threshold"`
	ScanDirectories  []string `mapstructure:"scan_directories"`
	ScanSettings     struct {
		ExcludedPatterns []string `mapstructure:"excluded_patterns"` // e.g., ["node_modules", "dist", ".git"]
		ExcludedPaths    []string `mapstructure:"excluded_paths"`    // Full paths to exclude
	} `mapstructure:"scan_settings"`
	RefreshInterval int `mapstructure:"refresh_interval"`
	DisplayStats    struct {
		ShowWelcomeMessage bool `mapstructure:"show_welcome_message"`
		ShowActiveProjects bool `mapstructure:"show_active_projects"`
		ShowInsights       bool `mapstructure:"show_insights"`
		MaxProjects        int  `mapstructure:"max_projects"`
		TableStyle         struct {
			UseTableHeader bool   `mapstructure:"use_table_header"`
			Style          string `mapstructure:"style"`
			Options        struct {
				DrawBorder      bool `mapstructure:"draw_border"`
				SeparateColumns bool `mapstructure:"separate_columns"`
				SeparateHeader  bool `mapstructure:"separate_header"`
				SeparateRows    bool `mapstructure:"separate_rows"`
			} `mapstructure:"options"`
		} `mapstructure:"table_style"`
		ActivityIndicators struct {
			HighActivity   string `mapstructure:"high_activity"`
			NormalActivity string `mapstructure:"normal_activity"`
			NoActivity     string `mapstructure:"no_activity"`
			StreakRecord   string `mapstructure:"streak_record"`
			ActiveStreak   string `mapstructure:"active_streak"`
		} `mapstructure:"activity_indicators"`
		Thresholds struct {
			HighActivity int `mapstructure:"high_activity"`
		} `mapstructure:"thresholds"`
		InsightSettings struct {
			TopLanguagesCount int  `mapstructure:"top_languages_count"`
			ShowDailyAverage  bool `mapstructure:"show_daily_average"`
			ShowTopLanguages  bool `mapstructure:"show_top_languages"`
			ShowPeakCoding    bool `mapstructure:"show_peak_coding"`
			ShowWeeklySummary bool `mapstructure:"show_weekly_summary"`
			ShowWeeklyGoal    bool `mapstructure:"show_weekly_goal"`
			ShowMostActive    bool `mapstructure:"show_most_active"`
		} `mapstructure:"insight_settings"`
	} `mapstructure:"display_stats"`
	GoalSettings struct {
		WeeklyCommitGoal int `mapstructure:"weekly_commit_goal"`
	} `mapstructure:"goal_settings"`
	Colors struct {
		HeaderColor string `mapstructure:"header_color"`
	}
	DetailedStats    bool `mapstructure:"detailed_stats"`
	Debug            bool `mapstructure:"debug"`
	LanguageSettings struct {
		ExcludedExtensions []string `mapstructure:"excluded_extensions"` // e.g., [".yaml", ".txt", ".md"]
		ExcludedLanguages  []string `mapstructure:"excluded_languages"`  // e.g., ["YAML", "Text", "Markdown"]
		MinimumLines       int      `mapstructure:"minimum_lines"`       // Minimum lines for a language to be included
		ShowDividers       bool     `mapstructure:"show_dividers"`       // Display dividers between languages in output

		LanguageDisplay struct {
			GoDisplay         string `mapstructure:"go_display"`         // Display name/icon for Go (e.g., "🔵 Go")
			PythonDisplay     string `mapstructure:"python_display"`     // Display name/icon for Python
			LuaDisplay        string `mapstructure:"lua_display"`        // Display name/icon for Lua
			JavaScriptDisplay string `mapstructure:"javascript_display"` // Display name/icon for JavaScript
			TypeScriptDisplay string `mapstructure:"typescript_display"` // Display name/icon for TypeScript
			RustDisplay       string `mapstructure:"rust_display"`       // Display name/icon for Rust
			CppDisplay        string `mapstructure:"cpp_display"`        // Display name/icon for C++
			CDisplay          string `mapstructure:"c_display"`          // Display name/icon for C
			JavaDisplay       string `mapstructure:"java_display"`       // Display name/icon for Java
			RubyDisplay       string `mapstructure:"ruby_display"`       // Display name/icon for Ruby
			PHPDisplay        string `mapstructure:"php_display"`        // Display name/icon for PHP
			HTMLDisplay       string `mapstructure:"html_display"`       // Display name/icon for HTML
			CSSDisplay        string `mapstructure:"css_display"`        // Display name/icon for CSS
			ShellDisplay      string `mapstructure:"shell_display"`      // Display name/icon for Shell
			DefaultDisplay    string `mapstructure:"default_display"`    // Display for any unspecified language
		} `mapstructure:"language_display"`
	} `mapstructure:"language_settings"`
	ShowDividers   bool `mapstructure:"show_dividers"`
	AuthorSettings struct {
		LookbackDays int `mapstructure:"lookback_days"`
		MaxTopRepos  int `mapstructure:"max_top_repos"`
	} `mapstructure:"author_settings"`
}

func (*Config) ValidateConfig

func (c *Config) ValidateConfig() error

Validate Config

type State

type State struct {
	ActiveProfile string `json:"active_profile"`
	IsValidated   bool   `json:"is_validated"`
}

type TestSetup added in v1.5.3

type TestSetup struct {
	TempHome string
	OrigHome string
	T        *testing.T
}

func SetupTestEnvironment added in v1.5.3

func SetupTestEnvironment(t *testing.T) *TestSetup

SetupTestEnvironment creates a temporary test environment

func (*TestSetup) Cleanup added in v1.5.3

func (ts *TestSetup) Cleanup()

Cleanup removes the temporary test environment

func (*TestSetup) CreateConfigFile added in v1.5.3

func (ts *TestSetup) CreateConfigFile(name string, content []byte)

CreateConfigFile creates a config file with the given content

func (*TestSetup) LoadTestConfig added in v1.5.3

func (ts *TestSetup) LoadTestConfig(filename string) []byte

LoadTestConfig loads a config file from the testdata directory

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳