|
|
@ -7,6 +7,8 @@ import (
|
|
7
|
7
|
"log"
|
|
8
|
8
|
"net/http"
|
|
9
|
9
|
"os"
|
|
|
10
|
"path"
|
|
|
11
|
"path/filepath"
|
|
10
|
12
|
"strings"
|
|
11
|
13
|
"time"
|
|
12
|
14
|
|
|
|
@ -19,6 +21,11 @@ func main() {
|
|
19
|
21
|
if len(os.Args) > 1 {
|
|
20
|
22
|
repoPath = os.Args[1]
|
|
21
|
23
|
}
|
|
|
24
|
var err error
|
|
|
25
|
repoPath, err = filepath.Abs(repoPath)
|
|
|
26
|
if err != nil {
|
|
|
27
|
log.Fatal("getting absolute path: ", err)
|
|
|
28
|
}
|
|
22
|
29
|
|
|
23
|
30
|
repo, err := git.OpenRepository(repoPath)
|
|
24
|
31
|
if err != nil {
|
|
|
@ -28,7 +35,7 @@ func main() {
|
|
28
|
35
|
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
|
|
29
|
36
|
buf := new(bytes.Buffer)
|
|
30
|
37
|
err = repoTmpl.Execute(buf, map[string]interface{}{
|
|
31
|
|
"RepoPath": repoPath,
|
|
|
38
|
"RepoPath": path.Base(repoPath),
|
|
32
|
39
|
"Repo": NewFancyRepo(repo),
|
|
33
|
40
|
"Style": template.CSS(repoStyle),
|
|
34
|
41
|
})
|