all repos — vite @ 87bb6a2abe44450fb6b71dd8a0c4b2479a3d753d

a fast (this time, actually) and minimal static site generator

main.go (view raw)

 1package main
 2
 3import (
 4	"fmt"
 5	"os"
 6)
 7
 8func main() {
 9	args := os.Args
10
11	helpStr := `usage: vite [options]
12
13A simple and minimal static site generator.
14
15options:
16    init PATH       create vite project at PATH
17    build           builds the current project
18    new PATH        create a new markdown post
19        `
20
21	// TODO: make arg parsing less shit
22
23	if len(args) <= 1 {
24		fmt.Println(helpStr)
25		return
26	}
27
28	switch args[1] {
29	case "init":
30		if len(args) <= 2 {
31			fmt.Println(helpStr)
32			return
33		}
34		initPath := args[2]
35		viteInit(initPath)
36	case "build":
37		_, err := os.Stat("config.yaml")
38		if err != nil {
39			return
40		}
41		viteBuild()
42	case "new":
43		if len(args) <= 2 {
44			fmt.Println(helpStr)
45			return
46		}
47		newPath := args[2]
48		viteNew(newPath)
49	}
50
51}