all repos — vite @ 58fc704075879dde45fb34eeb595c202f953d770

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

Improve argument parsing
Anirudh Oppiliappan x@icyphox.sh
Fri, 30 Oct 2020 21:48:02 +0530
commit

58fc704075879dde45fb34eeb595c202f953d770

parent

54a85a9389fb5a2b778631f0822a5f783a231d5d

1 files changed, 13 insertions(+), 0 deletions(-)

jump to
M main.gomain.go

@@ -22,15 +22,28 @@ // TODO: make arg parsing less shit

if len(args) <= 1 { fmt.Println(helpStr) + return } switch args[1] { case "init": + if len(args) <= 2 { + fmt.Println(helpStr) + return + } initPath := args[2] viteInit(initPath) case "build": + _, err := os.Stat("config.yaml") + if err != nil { + return + } viteBuild() case "new": + if len(args) <= 2 { + fmt.Println(helpStr) + return + } newPath := args[2] viteNew(newPath) }