Explorar el Código

Display only the repo/dir name in the title

Lucas Stadler %!s(int64=8) %!d(string=hace) años
padre
commit
7ab8bb566e
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  1. 8 1
      quit.go

+ 8 - 1
quit.go

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