Skip to content

Commit

Permalink
rename to docsgen
Browse files Browse the repository at this point in the history
Signed-off-by: Phil Prasek <[email protected]>
  • Loading branch information
prasek committed Oct 16, 2024
1 parent b77d66a commit e97eaa8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
6 changes: 3 additions & 3 deletions app/commandsgen/convert.go → app/docsgen/convert.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package commandsgen is built to read the YAML format described in
// temporalcli/commandsgen/commands.yml and generate code from it.
package commandsgen
// Package docsgen is built to convert the existing
// cli.Commands to a docs gen model and generate tcld docs from that
package docsgen

import (
"fmt"
Expand Down
4 changes: 3 additions & 1 deletion app/commandsgen/docs.go → app/docsgen/docs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package commandsgen
// Package docsgen is built to convert the existing
// cli.Commands to a docs gen model and generate tcld docs from that
package docsgen

import (
"bytes"
Expand Down
6 changes: 3 additions & 3 deletions app/commandsgen/enrich.go → app/docsgen/enrich.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package commandsgen is built to read the YAML format described in
// temporalcli/commandsgen/commands.yml and generate code from it.
package commandsgen
// Package docsgen is built to convert the existing
// cli.Commands to a docs gen model and generate tcld docs from that
package docsgen

import (
_ "embed"
Expand Down
6 changes: 3 additions & 3 deletions app/commandsgen/parse.go → app/docsgen/parse.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package commandsgen is built to read the YAML format described in
// temporalcli/commandsgen/commands.yml and generate code from it.
package commandsgen
// Package docsgen is built to convert the existing
// cli.Commands to a docs gen model and generate tcld docs from that
package docsgen

import (
_ "embed"
Expand Down
2 changes: 1 addition & 1 deletion app/commandsgen/tcld.yml → app/docsgen/tcld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ commands:
short: d
- name: expiry
type: timestamp
description: 'the absolute timestamp (RFC3339) when the apikey will expire, example: ''2024-10-16T15:30:07-07:00''.'
description: 'the absolute timestamp (RFC3339) when the apikey will expire, example: ''2024-10-16T16:48:12-07:00''.'
short: e
- name: name
type: string
Expand Down
10 changes: 5 additions & 5 deletions app/internal/cmd/gen-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"
"runtime"

"github.com/temporalio/tcld/app/commandsgen"
"github.com/temporalio/tcld/app/docsgen"
"gopkg.in/yaml.v3"
)

Expand All @@ -28,7 +28,7 @@ func run() error {
}

// Convert existing CLI commands to docs gen model
cmds, err := commandsgen.ConvertCommands()
cmds, err := docsgen.ConvertCommands()
if err != nil {
return fmt.Errorf("failed converting commands: %w", err)
}
Expand All @@ -40,20 +40,20 @@ func run() error {
fmt.Printf("Error while Marshaling. %v", err)
}

filePath := filepath.Join(file, "../../../../commandsgen/tcld.yml")
filePath := filepath.Join(file, "../../../../docsgen/tcld.yml")
err = os.WriteFile(filePath, yamlData, 0644)
if err != nil {
return fmt.Errorf("unable to write command yaml into %s", filePath)
}

// Enrich commands
cmds, err = commandsgen.EnrichCommands(cmds)
cmds, err = docsgen.EnrichCommands(cmds)
if err != nil {
return fmt.Errorf("failed enriching commands: %w", err)
}

// Generate docs
b, err := commandsgen.GenerateDocsFiles(cmds)
b, err := docsgen.GenerateDocsFiles(cmds)
if err != nil {
return err
}
Expand Down

0 comments on commit e97eaa8

Please sign in to comment.