Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AFS *afero.Afero FS afero.Fs )
Functions ¶
func GetCommand ¶
func SetFileSystem ¶
SetFileSystem sets the filesystem to use for the Sort command
Types ¶
type BlockListSorter ¶
BlockListSorter implements the sort.Interface for []*hclsyntax.Block
func (BlockListSorter) Len ¶
func (bs BlockListSorter) Len() int
Len returns the length of the array
func (BlockListSorter) Less ¶
func (bs BlockListSorter) Less(i, j int) bool
Less compares two blocks based on their types and labels
func (BlockListSorter) Swap ¶
func (bs BlockListSorter) Swap(i, j int)
Swap swaps two blocks in the array
type Params ¶
type Params struct {
// If the group-by-type flag is set, the resources will be grouped by type in the output files.
// Otherwise, the resources will be sorted alphabetically ascending by resource type and name in the existing files.
// Conflicts with the inline flag.
GroupByType bool `yaml:"group-by-type"`
// If the has-header flag is set, the input files have a header.
HasHeader bool `yaml:"has-header"`
// If the header-pattern flag is set, the header pattern will be used to find the header in the input files.
HeaderPattern string `yaml:"header-pattern"`
// If the inline flag is set, the resources will be sorted in place in the input files.
// Conflicts with the group-by-type and output-dir flags.
Inline bool `yaml:"inline"`
// If the keep-header flag is set, the header matched in the header pattern will be persisted in the output files.
KeepHeader bool `yaml:"keep-header"`
// If the output directory is set, the sorted files will be written to the output directory.
// Otherwise, the sorted files will be printed to stdout.
// Conflicts with the inline flag.
OutputDir string `yaml:"output-dir"`
// If the remove-comments flag is set, the comments will be removed from the files.
// Otherwise, the comments will be preserved.
RemoveComments bool `yaml:"remove-comments"`
}
Params represents the parameters for the sort command.
Click to show internal directories.
Click to hide internal directories.