-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
56 lines (45 loc) · 890 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"fmt"
bf "github.com/russross/blackfriday"
"gopkg.in/src-d/go-git.v4"
"io/ioutil"
"os"
)
type Website struct {
outputLocation string
templateLocation string
gitCacheLocation string
posts []Post
}
type Post struct {
name string
gitUrl string
}
func main() {
ps := []Post{
{
name: "setting-up-psps",
gitUrl: "https://github.com/octetz/setting-up-psps",
},
}
w := Website{
outputLocation: "",
templateLocation: "",
gitCacheLocation: "./tmp",
posts: ps,
}
_, err := git.PlainClone(w.gitCacheLocation+"/"+w.posts[0].name, false, &git.CloneOptions{
URL: w.posts[0].gitUrl,
Progress: os.Stdout,
})
if err != nil {
fmt.Println(err)
}
b, err := ioutil.ReadFile(w.gitCacheLocation+"/"+w.posts[0].name+"/README.md")
if err != nil {
fmt.Println(err)
}
output := bf.Run(b)
fmt.Printf("%s", output)
}