mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 12:58:35 +07:00
Considering the file strucutre below of main module and its submodules, now it is possible to generate documentation for them main and all its submodules in one execution, with `--recursive` flag. Note that generating documentation recursively is allowed only with `--output-file` set. Path to find submodules can be configured with `--recursive-path` (defaults to `modules`). Each submodule can also have their own `.terraform-docs.yml` confi file, to override configuration from root module. ``` . ├── README.md ├── main.tf ├── modules │ └── my-sub-module │ ├── README.md │ ├── main.tf │ ├── variables.tf │ └── versions.tf ├── outputs.tf ├── variables.tf └── versions.tf ``` Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
31 lines
782 B
Go
31 lines
782 B
Go
/*
|
|
Copyright 2021 The terraform-docs Authors.
|
|
|
|
Licensed under the MIT license (the "License"); you may not
|
|
use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at the LICENSE file in
|
|
the root directory of this source tree.
|
|
*/
|
|
|
|
package toml
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/terraform-docs/terraform-docs/internal/cli"
|
|
)
|
|
|
|
// NewCommand returns a new cobra.Command for 'toml' formatter
|
|
func NewCommand(runtime *cli.Runtime, config *cli.Config) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Args: cobra.ExactArgs(1),
|
|
Use: "toml [PATH]",
|
|
Short: "Generate TOML of inputs and outputs",
|
|
Annotations: cli.Annotations("toml"),
|
|
PreRunE: runtime.PreRunEFunc,
|
|
RunE: runtime.RunEFunc,
|
|
}
|
|
return cmd
|
|
}
|