Files
Claude 95b8e29bfe Remove the stray -h file; refdoc refuses flags
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
2026-11-23 09:42:48 +00:00

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)
}
}