mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 12:58:35 +07:00
* Introduce format interface and expose to public pkg * fix issues after merge * don't panic * Rename TFString back to String
41 lines
827 B
Go
41 lines
827 B
Go
package module
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/imdario/mergo"
|
|
)
|
|
|
|
// SortBy contains different sort criteria corresponding
|
|
// to available flags (e.g. name, required, etc)
|
|
type SortBy struct {
|
|
Name bool
|
|
Required bool
|
|
}
|
|
|
|
// Options contains required options to load a Module from path
|
|
type Options struct {
|
|
Path string
|
|
SortBy *SortBy
|
|
OutputValues bool
|
|
OutputValuesPath string
|
|
}
|
|
|
|
// NewOptions returns new instance of Options
|
|
func NewOptions() *Options {
|
|
return &Options{
|
|
Path: "",
|
|
SortBy: &SortBy{Name: false, Required: false},
|
|
OutputValues: false,
|
|
OutputValuesPath: "",
|
|
}
|
|
}
|
|
|
|
// With override options with existing Options
|
|
func (o *Options) With(override *Options) *Options {
|
|
if err := mergo.Merge(o, override); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
return o
|
|
}
|