-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgocpu.go
45 lines (40 loc) · 868 Bytes
/
gocpu.go
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
36
37
38
39
40
41
42
43
44
45
package main
import (
"os"
"github.com/sarthakpranesh/gocpu/commands"
"github.com/sarthakpranesh/gocpu/utils"
)
func main() {
var cmds []*utils.Subcommand = []*utils.Subcommand{
utils.NewSubCommand(
"watch",
func(s *utils.Subcommand) {
s.Fs.IntVar(&s.Interval, "int", 2, "Takes integer value for updating cpu freqency value")
},
commands.WatchFrequency,
),
utils.NewSubCommand(
"turbo",
func(s *utils.Subcommand) {
s.Fs.BoolVar(&s.Turbo, "enable", false, "If not passed, turbo boost will be disabled")
},
commands.TurboSet,
),
utils.NewSubCommand(
"govern",
func(s *utils.Subcommand) {},
commands.Governor,
),
}
if len(os.Args) > 1 {
subcommand := os.Args[1]
for _, cmd := range cmds {
if cmd.Name == subcommand {
cmd.Init(os.Args[2:])
cmd.Run()
return
}
}
}
utils.Help(cmds)
}