Files
terraform-docs/cmd/json/json.go
Khosrow Moossavi d2fe2b1b29 Move print package from internal to public
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-09-28 15:04:07 -04:00

36 lines
947 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 json
import (
"github.com/spf13/cobra"
"github.com/terraform-docs/terraform-docs/internal/cli"
"github.com/terraform-docs/terraform-docs/print"
)
// NewCommand returns a new cobra.Command for 'json' formatter
func NewCommand(runtime *cli.Runtime, config *print.Config) *cobra.Command {
cmd := &cobra.Command{
Args: cobra.ExactArgs(1),
Use: "json [PATH]",
Short: "Generate JSON of inputs and outputs",
Annotations: cli.Annotations("json"),
PreRunE: runtime.PreRunEFunc,
RunE: runtime.RunEFunc,
}
// flags
cmd.PersistentFlags().BoolVar(&config.Settings.Escape, "escape", true, "escape special characters")
return cmd
}