summaryrefslogtreecommitdiff
path: root/internal/autogen/manualgen.go
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2025-02-22 14:06:20 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2025-02-22 14:06:20 -0500
commit4221780ce53ff7484f6f1958173373dc963e7967 (patch)
treea9295bcc6161b97d33256b069ea3a5c8fe35e5ff /internal/autogen/manualgen.go
parentf36f77472a82d6ebfac153aed6d17f154ae239a6 (diff)
functional scratch dockerfile
Diffstat (limited to 'internal/autogen/manualgen.go')
-rw-r--r--internal/autogen/manualgen.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/internal/autogen/manualgen.go b/internal/autogen/manualgen.go
new file mode 100644
index 0000000..a3480c4
--- /dev/null
+++ b/internal/autogen/manualgen.go
@@ -0,0 +1,32 @@
+/*
+ * This package isn't the actual rafta server.
+ * To avoid importing packages which aren't needed at runtime,
+ * some auto-generation functionnalities is offloaded to here so
+ * it can be done with access to the rest of the code-base but
+ * without bloating the final binary. For example,
+ * generating bash+zsh auto-completion scripts isn't needed in
+ * the final binary if those script are generated before hand.
+ * Same gose for manpages. This file is meant to be run automatically
+ * to easily package new releases.
+ */
+package main
+
+import (
+ "log/slog"
+ "os"
+
+ "github.com/ChausseBenjamin/rafta/internal/app"
+ "github.com/ChausseBenjamin/rafta/internal/logging"
+ docs "github.com/urfave/cli-docs/v3"
+)
+
+func main() {
+ a := app.Command()
+
+ man, err := docs.ToManWithSection(a, 1)
+ if err != nil {
+ slog.Error("failed to generate man page", logging.ErrKey, err)
+ os.Exit(1)
+ }
+ os.Stdout.Write([]byte(man))
+}