diff --git a/.gitignore b/.gitignore index 96fe0936..10a7f077 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,4 @@ Defaults.mk /etc/wwapird.conf .dist/ userdocs/_* +userdocs/reference/* diff --git a/Makefile b/Makefile index 59927775..1303ae40 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ export GOPROXY WW_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree # 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 build: lint test-it vet all @@ -255,6 +255,12 @@ dist: vendor config cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION) 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. ## To setup latest protoc: ## Download the protobuf-all-[VERSION].tar.gz from https://github.com/protocolbuffers/protobuf/releases diff --git a/internal/app/wwctl/genconf/reference/main.go b/internal/app/wwctl/genconf/reference/main.go new file mode 100644 index 00000000..c3cdacaa --- /dev/null +++ b/internal/app/wwctl/genconf/reference/main.go @@ -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 +} diff --git a/internal/app/wwctl/genconf/reference/root.go b/internal/app/wwctl/genconf/reference/root.go new file mode 100644 index 00000000..de89d871 --- /dev/null +++ b/internal/app/wwctl/genconf/reference/root.go @@ -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 +} diff --git a/internal/app/wwctl/genconf/root.go b/internal/app/wwctl/genconf/root.go index 0c8afb2f..fc240021 100644 --- a/internal/app/wwctl/genconf/root.go +++ b/internal/app/wwctl/genconf/root.go @@ -3,6 +3,7 @@ package genconf import ( "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/reference" "github.com/spf13/cobra" ) @@ -21,6 +22,7 @@ var ( func init() { baseCmd.AddCommand(completions.GetCommand()) baseCmd.AddCommand(man.GetCommand()) + baseCmd.AddCommand(reference.GetCommand()) } // GetRootCommand returns the root cobra.Command for the application. diff --git a/userdocs/reference/glossary.rst b/userdocs/contents/glossary.rst similarity index 100% rename from userdocs/reference/glossary.rst rename to userdocs/contents/glossary.rst diff --git a/userdocs/index.rst b/userdocs/index.rst index 7b2b2ecc..c65537cd 100644 --- a/userdocs/index.rst +++ b/userdocs/index.rst @@ -41,9 +41,14 @@ Welcome to the Warewulf User Guide! Documentation Development Environment (KVM) Development Environment (VirtualBox) + Glossary .. toctree:: :maxdepth: 2 :caption: Reference + :glob: + + reference/* + + - Glossary