generate reference documentation
Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,3 +38,4 @@ Defaults.mk
|
|||||||
/etc/wwapird.conf
|
/etc/wwapird.conf
|
||||||
.dist/
|
.dist/
|
||||||
userdocs/_*
|
userdocs/_*
|
||||||
|
userdocs/reference/*
|
||||||
|
|||||||
8
Makefile
8
Makefile
@@ -101,7 +101,7 @@ export GOPROXY
|
|||||||
WW_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
|
WW_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
all: config vendor wwctl wwclient man_pages config_defaults print_defaults wwapid wwapic wwapird print_mnts
|
all: config vendor wwctl wwclient man_pages config_defaults print_defaults wwapid wwapic wwapird
|
||||||
|
|
||||||
# Validate source and build all packages
|
# Validate source and build all packages
|
||||||
build: lint test-it vet all
|
build: lint test-it vet all
|
||||||
@@ -255,6 +255,12 @@ dist: vendor config
|
|||||||
cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION)
|
cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION)
|
||||||
rm -rf .dist
|
rm -rf .dist
|
||||||
|
|
||||||
|
reference: wwctl
|
||||||
|
./wwctl genconfig reference userdocs/reference/
|
||||||
|
|
||||||
|
latexpdf: reference
|
||||||
|
make -C userdocs latexpdf
|
||||||
|
|
||||||
## wwapi generate code from protobuf. Requires protoc and protoc-grpc-gen-gateway to generate code.
|
## wwapi generate code from protobuf. Requires protoc and protoc-grpc-gen-gateway to generate code.
|
||||||
## To setup latest protoc:
|
## To setup latest protoc:
|
||||||
## Download the protobuf-all-[VERSION].tar.gz from https://github.com/protocolbuffers/protobuf/releases
|
## Download the protobuf-all-[VERSION].tar.gz from https://github.com/protocolbuffers/protobuf/releases
|
||||||
|
|||||||
17
internal/app/wwctl/genconf/reference/main.go
Normal file
17
internal/app/wwctl/genconf/reference/main.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package reference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/cobra/doc"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CobraRunE(cmd *cobra.Command, args []string) (err error) {
|
||||||
|
linkHandler := func(name, ref string) string {
|
||||||
|
return fmt.Sprintf(":ref:`%s <%s>`", name, ref)
|
||||||
|
}
|
||||||
|
err = doc.GenReSTTreeCustom(cmd.Parent().Parent(), args[0], func(arg string) string { return "" }, linkHandler)
|
||||||
|
//err = doc.GenReSTTree(cmd.Parent().Parent(), args[0])
|
||||||
|
return
|
||||||
|
}
|
||||||
22
internal/app/wwctl/genconf/reference/root.go
Normal file
22
internal/app/wwctl/genconf/reference/root.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package reference
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
baseCmd = &cobra.Command{
|
||||||
|
Use: "reference",
|
||||||
|
Short: "reference generation",
|
||||||
|
Long: "This command generates the references in ReStructured Text, needs target dir as argument",
|
||||||
|
RunE: CobraRunE,
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetCommand() *cobra.Command {
|
||||||
|
return baseCmd
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package genconf
|
|||||||
import (
|
import (
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/genconf/completions"
|
"github.com/hpcng/warewulf/internal/app/wwctl/genconf/completions"
|
||||||
"github.com/hpcng/warewulf/internal/app/wwctl/genconf/man"
|
"github.com/hpcng/warewulf/internal/app/wwctl/genconf/man"
|
||||||
|
"github.com/hpcng/warewulf/internal/app/wwctl/genconf/reference"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ var (
|
|||||||
func init() {
|
func init() {
|
||||||
baseCmd.AddCommand(completions.GetCommand())
|
baseCmd.AddCommand(completions.GetCommand())
|
||||||
baseCmd.AddCommand(man.GetCommand())
|
baseCmd.AddCommand(man.GetCommand())
|
||||||
|
baseCmd.AddCommand(reference.GetCommand())
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetRootCommand returns the root cobra.Command for the application.
|
// GetRootCommand returns the root cobra.Command for the application.
|
||||||
|
|||||||
@@ -41,9 +41,14 @@ Welcome to the Warewulf User Guide!
|
|||||||
Documentation <contributing/documentation>
|
Documentation <contributing/documentation>
|
||||||
Development Environment (KVM) <contributing/development-environment-kvm>
|
Development Environment (KVM) <contributing/development-environment-kvm>
|
||||||
Development Environment (VirtualBox) <contributing/development-environment-vbox>
|
Development Environment (VirtualBox) <contributing/development-environment-vbox>
|
||||||
|
Glossary <contents/glossary>
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
:caption: Reference
|
:caption: Reference
|
||||||
|
:glob:
|
||||||
|
|
||||||
|
reference/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Glossary <reference/glossary>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user