Skip to content

Commit d487a00

Browse files
committed
generate-config: Rename from incus-doc
Signed-off-by: Lucas Bremgartner <[email protected]>
1 parent c1132e9 commit d487a00

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ endif
143143
.PHONY: update-metadata
144144
update-metadata: build
145145
@echo "Generating golang documentation metadata"
146-
cd cmd/generate-config && CGO_ENABLED=0 $(GO) build -o $(GOPATH)/bin/incus-doc
147-
$(GOPATH)/bin/incus-doc . --json ./internal/server/metadata/configuration.json --txt ./doc/config_options.txt
146+
cd cmd/generate-config && CGO_ENABLED=0 $(GO) build -o $(GOPATH)/bin/generate-config
147+
$(GOPATH)/bin/generate-config . --json ./internal/server/metadata/configuration.json --txt ./doc/config_options.txt
148148

149149
.PHONY: doc-setup
150150
doc-setup: client

cmd/generate-config/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# incus-doc
1+
# generate-config
22

33
A small CLI to parse comments in a Golang codebase meant to be used for a documentation tool (like Sphinx for example).
44

55
It parses the comments from the AST and extracts their documentation.
66

77
# Usage
88

9-
$ incus-doc -h
10-
Usage of incus-doc:
9+
$ generate-config -h
10+
Usage of generate-config:
1111
-e value
1212
Path that will be excluded from the process
1313

@@ -78,7 +78,7 @@ A comment is formatted this way:
7878

7979
The go-swagger spec from source generator can only handles `swagger:meta` (global file/package level documentation), `swagger:route` (API endpoints), `swagger:params` (function parameters), `swagger:operation` (method documentation), `swagger:response` (API response content documentation), `swagger:model` (struct documentation) generation. In our use case, we would want a config variable spec generator that can bundle any key-value data pairs alongside metadata to build a sense of hierarchy and identity (we want to associate a unique key to each gendoc comment group that will also be displayed in the generated documentation)
8080

81-
In a swagger fashion, `incus-doc` can associate metadata key-value pairs (here for example, `group` and `key`) to data key-value pairs. As a result, it can generate a YAML tree out of the code documentation and also a Markdown document.
81+
In a swagger fashion, `generate-config` can associate metadata key-value pairs (here for example, `group` and `key`) to data key-value pairs. As a result, it can generate a YAML tree out of the code documentation and also a Markdown document.
8282

8383
## Output
8484

cmd/generate-config/incus_doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func writeDocFile(inputJSONPath, outputTxtPath string) error {
296296

297297
sortedEntityKeys := getSortedKeysFromMap(jsonDoc.Configs)
298298
// create a string buffer
299-
buffer := bytes.NewBufferString("// Code generated by incus-doc; DO NOT EDIT.\n\n")
299+
buffer := bytes.NewBufferString("// Code generated by generate-config from the incus project; DO NOT EDIT.\n\n")
300300
for _, entityKey := range sortedEntityKeys {
301301
entityEntries := jsonDoc.Configs[entityKey]
302302
sortedGroupKeys := getSortedKeysFromMap(entityEntries.(map[string]any))

cmd/generate-config/incus_doc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/stretchr/testify/assert"
77
)
88

9-
// Test the alphabetical sorting of a `incus-doc` JSON structure.
9+
// Test the alphabetical sorting of a `generate-config` JSON structure.
1010
func TestJSONSorted(t *testing.T) {
1111
projectEntries := make(map[string]any)
1212
projectEntries["entityKey1"] = map[string]any{

cmd/generate-config/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ var exclude []string
1212
var jsonOutput string
1313
var txtOutput string
1414
var rootCmd = &cobra.Command{
15-
Use: "incus-doc",
16-
Short: "incus-doc - a simple tool to generate documentation for Incus",
17-
Long: "incus-doc - a simple tool to generate documentation for Incus. It outputs a YAML and a Markdown file that contain the content of all `gendoc:generate` statements in the project.",
15+
Use: "generate-config",
16+
Short: "generate-config - a simple tool to generate documentation for Incus",
17+
Long: "generate-config - a simple tool to generate documentation for Incus. It outputs a YAML and a Markdown file that contain the content of all `gendoc:generate` statements in the project.",
1818
Args: cobra.ExactArgs(1),
1919
Run: func(cmd *cobra.Command, args []string) {
2020
if len(args) != 1 {
@@ -42,9 +42,9 @@ func main() {
4242
rootCmd.Flags().StringVarP(&txtOutput, "txt", "t", "", "Output TXT file containing the generated documentation")
4343
err := rootCmd.Execute()
4444
if err != nil {
45-
fmt.Fprintf(os.Stderr, "incus-doc failed: %v", err)
45+
fmt.Fprintf(os.Stderr, "generate-config failed: %v", err)
4646
os.Exit(1)
4747
}
4848

49-
log.Println("incus-doc finished successfully")
49+
log.Println("generate-config finished successfully")
5050
}

doc/config_options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by incus-doc; DO NOT EDIT.
1+
// Code generated by generate-config from the incus project; DO NOT EDIT.
22

33
<!-- config group cluster-cluster start -->
44
```{config:option} scheduler.instance cluster-cluster

0 commit comments

Comments
 (0)