-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
35 lines (31 loc) · 1005 Bytes
/
config.go
File metadata and controls
35 lines (31 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"flag"
"time"
)
// AppConfig holds the application configuration
type AppConfig struct {
Version string
GridColumns int
UpdateInterval time.Duration
HistorySize int
LogicalCores bool
}
// DefaultConfig returns the default configuration
func DefaultConfig() *AppConfig {
return &AppConfig{
Version: "0.6.0",
GridColumns: 8,
UpdateInterval: 2 * time.Second,
HistorySize: 30,
LogicalCores: true,
}
}
// ParseFlags parses command-line flags and updates the configuration
func (c *AppConfig) ParseFlags() {
flag.IntVar(&c.GridColumns, "columns", c.GridColumns, "Number of columns in the grid layout")
flag.DurationVar(&c.UpdateInterval, "interval", c.UpdateInterval, "Update interval for CPU monitoring")
flag.IntVar(&c.HistorySize, "history", c.HistorySize, "Number of historical data points to keep")
flag.BoolVar(&c.LogicalCores, "logical", c.LogicalCores, "Show logical cores (true) or physical cores (false)")
flag.Parse()
}