cli

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 module.Options from generated and normalized Config and initializes required print.Format instance and executes it.

Types

type Config

type Config struct {
	File         string       `yaml:"-"`
	Formatter    string       `yaml:"formatter"`
	HeaderFrom   string       `yaml:"header-from"`
	Sections     sections     `yaml:"sections"`
	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