Skip to content

Commit

Permalink
Added more docs and version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Kavinraja-G committed Apr 21, 2024
1 parent 069c0e2 commit 9878780
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cmd/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ var outputFileName string
// NewCmdMarkdown drives the markdown command for x-docs
func NewCmdMarkdown() *cobra.Command {
cmd := &cobra.Command{
Use: "markdown [PATH]",
Short: "Generates markdown based docs for Crossplane resources",
Use: "markdown [PATH]",
Short: "Generates markdown based docs for Crossplane resources",
Example: `
# Move to the directory which has XRDs & Compositions
crossplane-docs markdown ./samples -o samples/README.md
`,
Aliases: []string{"md"},
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import "github.com/spf13/cobra"
func NewCmdRoot() *cobra.Command {
cmd := &cobra.Command{
Use: "crossplane-docs",
Aliases: []string{"x-docs"},
Short: "crossplane-docs - Docs generator for your crossplane resources",
Version: "0.1.0",
RunE: func(c *cobra.Command, args []string) error {
if err := c.Help(); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions pkg/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func getXRDSpecData(schema extv1.JSONSchemaProps, xrcOutputData *[]XRDSpecData,
Required: slices.Contains(requiredFields, propName),
})
if propValue.Properties != nil {
// recursively iterate all the nested properties
getXRDSpecData(propValue, xrcOutputData, append(schemaPath, propName), propValue.Required)
}
}
Expand Down
2 changes: 1 addition & 1 deletion samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
|------|-------|------|-------|-------|
| spec | | object | Required spec field for your API | false |
| parameters | spec | object | | true |
| storageGB | spec.parameters | integer | size of the Database in GB - integer | true |
| dbName | spec.parameters | string | name of the new DB inside the DB instance - string | true |
| instanceSize | spec.parameters | string | instance size - string | true |
| storageGB | spec.parameters | integer | size of the Database in GB - integer | true |
#### Resources
| Name | Kind | API Version |
|------|------|-------------|
Expand Down

0 comments on commit 9878780

Please sign in to comment.