summaryrefslogtreecommitdiff
path: root/crocc.go
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 /crocc.go
parent99804ef20781b7d7da6f683143f71e8ffeeb18e2 (diff)
Add default flags
Diffstat (limited to 'crocc.go')
-rw-r--r--crocc.go46
1 files changed, 45 insertions, 1 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
+ }
+}