mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Update documentation
This commit is contained in:
@@ -1,50 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Function to generate anchor from package path
|
||||
generate_anchor() {
|
||||
echo "$1" | tr '/' '-'
|
||||
}
|
||||
|
||||
# Create documentation file
|
||||
echo "# Lemma Package Documentation
|
||||
echo "# Lemma Package Documentation"
|
||||
echo ""
|
||||
echo "Generated documentation for all packages in the Lemma project."
|
||||
echo ""
|
||||
echo "## Table of Contents"
|
||||
|
||||
Generated documentation for all packages in the Lemma project.
|
||||
|
||||
## Table of Contents
|
||||
" > documentation.md
|
||||
|
||||
# Find all directories containing .go files (excluding test files)
|
||||
# Sort them for consistent output
|
||||
PACKAGES=$(find . -type f -name "*.go" ! -name "*_test.go" -exec dirname {} \; | sort -u | grep -v "/\.")
|
||||
|
||||
# Generate table of contents
|
||||
for PKG in $PACKAGES; do
|
||||
# Strip leading ./
|
||||
PKG_PATH=${PKG#./}
|
||||
# Skip if empty
|
||||
[ -z "$PKG_PATH" ] && continue
|
||||
|
||||
ANCHOR=$(generate_anchor "$PKG_PATH")
|
||||
echo "- [$PKG_PATH](#$ANCHOR)" >> documentation.md
|
||||
echo "- [$PKG_PATH](#$ANCHOR)"
|
||||
done
|
||||
|
||||
echo "" >> documentation.md
|
||||
echo ""
|
||||
|
||||
# Generate documentation for each package
|
||||
for PKG in $PACKAGES; do
|
||||
# Strip leading ./
|
||||
PKG_PATH=${PKG#./}
|
||||
# Skip if empty
|
||||
[ -z "$PKG_PATH" ] && continue
|
||||
|
||||
echo "## $PKG_PATH" >> documentation.md
|
||||
echo "" >> documentation.md
|
||||
echo '```go' >> documentation.md
|
||||
go doc -all "./$PKG_PATH" >> documentation.md
|
||||
echo '```' >> documentation.md
|
||||
echo "" >> documentation.md
|
||||
done
|
||||
|
||||
echo "Documentation generated in documentation.md"
|
||||
echo "## $PKG_PATH"
|
||||
echo ""
|
||||
echo '```go'
|
||||
go doc -all "./$PKG_PATH" | cat
|
||||
echo '```'
|
||||
echo ""
|
||||
done
|
||||
Reference in New Issue
Block a user