-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtindra.go
51 lines (38 loc) · 884 Bytes
/
tindra.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
package main
import (
"./context"
"flag"
"fmt"
"log"
"os"
"path/filepath"
"syscall"
)
// var Debug bool = false // TODO: Add custom logging class
// TODO: Add flag for usage of local relative paths in generation
var target string
func init() {
flag.StringVar(&target, "target", "", "location of site to generate")
flag.Parse()
}
func main() {
if len(target) == 0 {
flag.PrintDefaults()
os.Exit(int(syscall.EINVAL))
}
// TODO: Test if target is valid (make approximation)
source, err := filepath.Abs(target)
fmt.Printf("generating: %s\n", target)
fmt.Printf("path: %s\n\n", source)
if err != nil {
log.Fatal("could not get current working directory!")
}
defer func() {
if r := recover(); r != nil {
fmt.Println("error: ", r)
}
}()
site := context.NewContext(source)
site.Install(filepath.Join(source, "/build"))
fmt.Printf("\ndone\n")
}