-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
36 lines (28 loc) · 802 Bytes
/
main.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
// Package main deals with the CLI interface and overall program control flow.
package main
import (
"log"
"os"
// "net/http"
// "github.com/GeertJohan/go.rice"
"github.com/cdkini/clocviz/src/utils"
"github.com/cdkini/clocviz/src/web"
)
func main() {
if len(os.Args) != 2 {
log.Fatal("clocviz: Usage 'clocviz [src]'")
}
// Run cloc to generate file system and related stats
raw, err := utils.RunCloc(os.Args[1])
if err != nil {
log.Fatal(err)
}
// Parse data and aggregate into object to be fed into template
data := utils.ParseResults(raw)
byLang := utils.GetLinesByLang(data)
byFile := utils.GetLinesByFile(data)
content := web.NewContent("Test", byLang, byFile)
// Feed data into HTML/CSS/JS, start server, and render to browser
web.Serve(content, 8080)
os.Exit(0)
}