about summary refs log tree commit diff stats
path: root/process
diff options
context:
space:
mode:
authorAlan Pearce2024-05-05 18:11:56 +0200
committerAlan Pearce2024-05-05 18:11:56 +0200
commit2430f46a9948b38b06880606a95dec357d01f619 (patch)
tree2d8e9078b99ade7e9fe339be805890c635f0e235 /process
parent158904f480e558ca00f680e7c577bb6329605eff (diff)
downloadsearchix-2430f46a9948b38b06880606a95dec357d01f619.tar.lz
searchix-2430f46a9948b38b06880606a95dec357d01f619.tar.zst
searchix-2430f46a9948b38b06880606a95dec357d01f619.zip
feat: render markdown in option descriptions
Diffstat (limited to 'process')
-rw-r--r--process/main.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/process/main.go b/process/main.go
new file mode 100644
index 0000000..3c9b67a
--- /dev/null
+++ b/process/main.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+	"log"
+	"log/slog"
+	"os"
+	"searchix/internal/options"
+
+	"github.com/ardanlabs/conf/v3"
+	"github.com/pkg/errors"
+)
+
+type Config struct {
+	Input  string `conf:"short:i,required,help:NixOS options file (json)"`
+	Output string `conf:"short:o,default:/dev/stdout"`
+}
+
+func main() {
+	if os.Getenv("DEBUG") != "" {
+		slog.SetLogLoggerLevel(slog.LevelDebug)
+	}
+	log.SetFlags(0)
+
+	config := Config{}
+	help, err := conf.Parse("", &config)
+	if err != nil {
+		if errors.Is(err, conf.ErrHelpWanted) {
+			log.Fatalln(help)
+		}
+		log.Fatalf("parsing command line: %v", err)
+	}
+
+	err = options.Process(config.Input, config.Output)
+	if err != nil {
+		log.Fatalf("Error processing file: %v", err)
+	}
+}