cli

package
v0.12.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OutputTemplate = fmt.Sprintf("%s\n%s\n%s", outputBeginComment, outputContent, outputEndComment)
	OutputModes    = strings.Join([]string{outputModeInject, outputModeReplace}, ", ")
)

Output to file template and modes

View Source
var AllSections = strings.Join(allSections, ", ")

AllSections list.

Functions

func Annotations

func Annotations(cmd string) map[string]string

Annotations returns set of annotations for cobra.Commands, specifically the command 'name' and command 'kind'

func PreRunEFunc

func PreRunEFunc(config *Config) func(*cobra.Command, []string) error

PreRunEFunc returns actual 'cobra.Command#PreRunE' function for 'formatter' commands. This functions reads and normalizes flags and arguments passed through CLI execution.

func RunEFunc

func RunEFunc(config *Config) func(*cobra.Command, []string) error

RunEFunc returns actual 'cobra.Command#RunE' function for 'formatter' commands. This functions extract print.Settings and terraform.Options from generated and normalized Config and initializes required print.Format instance and executes it.

Types

type Config

type Config struct {
	BaseDir      string       `yaml:"-"`
	File         string       `yaml:"-"`
	Formatter    string       `yaml:"formatter"`
	HeaderFrom   string       `yaml:"header-from"`
	Sections     sections     `yaml:"sections"`
	Output       output       `yaml:"output"`
	OutputValues outputvalues `yaml:"output-values"`
	Sort         sort         `yaml:"sort"`
	Settings     settings     `yaml:"settings"`
}

Config represents all the available config options that can be accessed and passed through CLI

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns new instance of Config with default values set

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL