mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
Running 'go run ./internal/confedit/refdoc -h' wrote the reference to a
file named -h, and commit 4d8f8a9 added it. Remove it, and make refdoc
stop with a usage line when its argument starts with '-'.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTD8BSptdpaUWGcs65
26 lines
630 B
Go
26 lines
630 B
Go
// Command refdoc writes docs/wiki/Configuration-Reference.md from
|
|
// bbs.conf.sample (confedit.Reference): go generate ./internal/confedit.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
|
|
bbssec "github.com/D-Modem/bbs"
|
|
"github.com/D-Modem/bbs/internal/confedit"
|
|
)
|
|
|
|
func main() {
|
|
out := "docs/wiki/Configuration-Reference.md"
|
|
if len(os.Args) > 2 || len(os.Args) == 2 && strings.HasPrefix(os.Args[1], "-") {
|
|
log.Fatal("usage: refdoc [output.md]")
|
|
}
|
|
if len(os.Args) == 2 {
|
|
out = os.Args[1]
|
|
}
|
|
if err := os.WriteFile(out, confedit.Reference(confedit.NewCatalog(bbssec.Sample)), 0o644); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|