summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Paul <n@nc0.fr>2023-04-25 17:14:39 +0200
committerNicolas Paul <n@nc0.fr>2023-04-25 17:14:39 +0200
commit12d086bf4a0dc9422ccbb3ef7b38625e4cc98d89 (patch)
treedc52afdd2e3ec9e94d23783d4dc44e8c6637feb4
parent99804ef20781b7d7da6f683143f71e8ffeeb18e2 (diff)
Add default flags
-rw-r--r--crocc.go46
-rw-r--r--go.mod7
-rw-r--r--go.sum7
3 files changed, 58 insertions, 2 deletions
diff --git a/crocc.go b/crocc.go
index ecf7544..7be6806 100644
--- a/crocc.go
+++ b/crocc.go
@@ -3,4 +3,48 @@
// license that can be found in the LICENSE file.
// Package crocc is a simple Markdown-based static site generator.
-package crocc
+package main /* import "go.nc0.fr/crocc" */
+
+import (
+ "flag"
+ "log"
+)
+
+var (
+ outputdir = flag.String("out", "dst", "output directory")
+ url = flag.String("url", "http://localhost", "site URL")
+ sitemap = flag.Bool("sitemap", false, "generate sitemap.xml")
+ generateHidden = flag.Bool("hidden", false, "generate hidden pages")
+ verbose = flag.Bool("v", false, "verbose output")
+ version = flag.Bool("version", false, "print version and exit")
+)
+
+const usage string = `crocc is a simple Markdown-based static site generator.
+It is designed to be simple and fast, and to be used with a static web server.
+
+Author: Nicolas Paul <n@nc0.fr> (https://nc0.fr)
+License: BSD 3-Clause
+Repository: https://github.com/n1c00o/crocc
+
+Usage:
+ crocc [options] [input directory]
+
+Options:`
+
+const Version string = "1.0.0"
+
+func init() {
+ flag.Usage = func() {
+ log.Println(usage)
+ flag.PrintDefaults()
+ }
+}
+
+func main() {
+ flag.Parse()
+
+ if *version {
+ log.Printf("crocc v%s\n", Version)
+ return
+ }
+}
diff --git a/go.mod b/go.mod
index c74d926..3ef18e1 100644
--- a/go.mod
+++ b/go.mod
@@ -2,4 +2,9 @@ module go.nc0.fr/crocc
go 1.20
-require github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a // indirect
+require (
+ github.com/BurntSushi/toml v0.3.1 // indirect
+ github.com/adrg/frontmatter v0.2.0 // indirect
+ github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a // indirect
+ gopkg.in/yaml.v2 v2.3.0 // indirect
+)
diff --git a/go.sum b/go.sum
index c544fb0..7d177c8 100644
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,9 @@
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/adrg/frontmatter v0.2.0 h1:/DgnNe82o03riBd1S+ZDjd43wAmC6W35q67NHeLkPd4=
+github.com/adrg/frontmatter v0.2.0/go.mod h1:93rQCj3z3ZlwyxxpQioRKC1wDLto4aXHrbqIsnH9wmE=
github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a h1:AWZzzFrqyjYlRloN6edwTLTUbKxf5flLXNuTBDm3Ews=
github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
+gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=