-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (38 loc) · 794 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
package main
import (
"bytes"
"flag"
"fmt"
"html"
"log"
"os"
"text/template"
"time"
)
var holder string
func init() {
flag.StringVar(&holder, "holder", "Georg Held", "the Copyright holder")
}
type templInfo struct {
Year int
Holder string
}
func main() {
liFile, err := os.Create("LICENSE.md")
if err != nil {
log.Fatal("Creating LICENSE.md: ", err)
}
defer liFile.Close()
reFile, err := os.Create("README.md")
if err != nil {
log.Fatal("Creating README.md: ", err)
}
defer reFile.Close()
info := templInfo{Year: time.Now().Year(), Holder: holder}
templ := template.Must(template.New("name").Parse(templateString))
var buffer bytes.Buffer
templ.Execute(&buffer, info)
s := html.UnescapeString(buffer.String())
fmt.Fprint(liFile, s)
fmt.Fprint(reFile, s)
}