cli

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 15 Imported by: 40

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFieldsFilterFlags

func AddFieldsFilterFlags(cmd *cobra.Command, defaults *FieldsFilterFlagsDefaults) error

AddFieldsFilterFlags adds the flags for the following middlewares to the cmd: - FieldsFilterMiddleware - SortColumnsMiddleware - ReorderColumnOrderMiddleware

func AddFlags

func AddFlags(cmd *cobra.Command, defaults *FlagsDefaults) error

func AddOutputFlags

func AddOutputFlags(cmd *cobra.Command, defaults *OutputFlagsDefaults) error

func AddRenameFlags

func AddRenameFlags(cmd *cobra.Command, defaults *RenameFlagsDefaults) error

func AddReplaceFlags

func AddReplaceFlags(cmd *cobra.Command, defaults *ReplaceFlagsDefaults) error

func AddSelectFlags

func AddSelectFlags(cmd *cobra.Command, defaults *SelectFlagsDefaults) error

func AddTemplateFlags

func AddTemplateFlags(cmd *cobra.Command, defaults *TemplateFlagsDefaults) error

Types

type FieldsFilterFlagsDefaults

type FieldsFilterFlagsDefaults struct {
	Fields      []string `glazed.parameter:"fields"`
	Filter      []string `glazed.parameter:"filter"`
	SortColumns bool     `glazed.parameter:"sort-columns"`
}

func NewFieldsFilterFlagsDefaults

func NewFieldsFilterFlagsDefaults() *FieldsFilterFlagsDefaults

type FieldsFilterSettings

type FieldsFilterSettings struct {
	Filters        []string `glazed.parameter:"filter"`
	Fields         []string `glazed.parameter:"fields"`
	SortColumns    bool     `glazed.parameter:"sort-columns"`
	ReorderColumns []string
}

func NewFieldsFilterSettings added in v0.2.6

func NewFieldsFilterSettings(parameters map[string]interface{}) (*FieldsFilterSettings, error)

func ParseFieldsFilterFlags

func ParseFieldsFilterFlags(cmd *cobra.Command) (*FieldsFilterSettings, error)

func (*FieldsFilterSettings) AddMiddlewares

func (ffs *FieldsFilterSettings) AddMiddlewares(of formatters.OutputFormatter)

func (*FieldsFilterSettings) UpdateWithSelectSettings

func (ffs *FieldsFilterSettings) UpdateWithSelectSettings(ss *SelectSettings)

type FlagsDefaults

type FlagsDefaults struct {
	Output       *OutputFlagsDefaults
	Select       *SelectFlagsDefaults
	Rename       *RenameFlagsDefaults
	Template     *TemplateFlagsDefaults
	FieldsFilter *FieldsFilterFlagsDefaults
	Replace      *ReplaceFlagsDefaults
}

func NewFlagsDefaults

func NewFlagsDefaults() *FlagsDefaults

type OutputFlagsDefaults

type OutputFlagsDefaults struct {
	Output          string `glazed.parameter:"output"`
	OutputFile      string `glazed.parameter:"output-file"`
	TableFormat     string `glazed.parameter:"table-format"`
	WithHeaders     bool   `glazed.parameter:"with-headers"`
	CsvSeparator    string `glazed.parameter:"csv-separator"`
	OutputAsObjects bool   `glazed.parameter:"output-as-objects"`
	Flatten         bool   `glazed.parameter:"flatten"`
	TemplateFile    string `glazed.parameter:"template-file"`
}

func NewOutputFlagsDefaults

func NewOutputFlagsDefaults() *OutputFlagsDefaults

type OutputFormatterSettings

type OutputFormatterSettings struct {
	Output                    string `glazed.parameter:"output"`
	TableFormat               string `glazed.parameter:"table-format"`
	OutputAsObjects           bool   `glazed.parameter:"output-as-objects"`
	FlattenObjects            bool   `glazed.parameter:"flatten"`
	WithHeaders               bool   `glazed.parameter:"with-headers"`
	CsvSeparator              string `glazed.parameter:"csv-separator"`
	Template                  string
	TemplateFormatterSettings *TemplateFormatterSettings
}

func NewOutputFormatterSettings added in v0.2.6

func NewOutputFormatterSettings(parameters map[string]interface{}) (*OutputFormatterSettings, error)

func ParseOutputFlags

func ParseOutputFlags(cmd *cobra.Command) (*OutputFormatterSettings, error)

func (*OutputFormatterSettings) CreateOutputFormatter

func (ofs *OutputFormatterSettings) CreateOutputFormatter() (formatters.OutputFormatter, error)

func (*OutputFormatterSettings) UpdateWithSelectSettings

func (ofs *OutputFormatterSettings) UpdateWithSelectSettings(ss *SelectSettings)

type RenameFlagsDefaults

type RenameFlagsDefaults struct {
	Rename       []string          `glazed.parameter:"rename"`
	RenameRegexp map[string]string `glazed.parameter:"rename-regexp"`
	RenameYaml   string            `glazed.parameter:"rename-yaml"`
}

func NewRenameFlagsDefaults

func NewRenameFlagsDefaults() *RenameFlagsDefaults

type RenameSettings

type RenameSettings struct {
	RenameFields  map[types.FieldName]string
	RenameRegexps middlewares.RegexpReplacements
	YamlFile      string
}

func ParseRenameFlags

func ParseRenameFlags(cmd *cobra.Command) (*RenameSettings, error)

func (*RenameSettings) AddMiddlewares

func (rs *RenameSettings) AddMiddlewares(of formatters.OutputFormatter) error

type ReplaceFlagsDefaults

type ReplaceFlagsDefaults struct {
	// currently, only support loading replacements from a file
	ReplaceFile string
}

func NewReplaceFlagsDefaults

func NewReplaceFlagsDefaults() *ReplaceFlagsDefaults

type ReplaceSettings

type ReplaceSettings struct {
	ReplaceFile string
}

func ParseReplaceFlags

func ParseReplaceFlags(cmd *cobra.Command) (*ReplaceSettings, error)

func (*ReplaceSettings) AddMiddlewares

func (rs *ReplaceSettings) AddMiddlewares(of formatters.OutputFormatter) error

type SelectFlagsDefaults

type SelectFlagsDefaults struct {
	Select         string
	SelectTemplate string
}

func NewSelectFlagsDefaults

func NewSelectFlagsDefaults() *SelectFlagsDefaults

type SelectSettings

type SelectSettings struct {
	SelectField    string `glazed.parameter:"select-field"`
	SelectTemplate string `glazed.parameter:"select-template"`
}

func ParseSelectFlags

func ParseSelectFlags(cmd *cobra.Command) (*SelectSettings, error)

type TemplateFlagsDefaults

type TemplateFlagsDefaults struct {
	Template        string            `glazed.parameter:"template"`
	TemplateField   map[string]string `glazed.parameter:"template-field"`
	UseRowTemplates bool              `glazed.parameter:"use-row-templates"`
}

func NewTemplateFlagsDefaults

func NewTemplateFlagsDefaults() *TemplateFlagsDefaults

type TemplateFormatterSettings

type TemplateFormatterSettings struct {
	TemplateFuncMaps []template.FuncMap
	AdditionalData   map[string]interface{} `glazed.parameter:"template-data"`
}

type TemplateSettings

type TemplateSettings struct {
	RenameSeparator string
	UseRowTemplates bool `glazed.parameter:"use-row-templates"`
	Templates       map[types.FieldName]string
}

func NewTemplateSettings added in v0.2.6

func NewTemplateSettings(parameters map[string]interface{}) (*TemplateSettings, error)

func ParseTemplateFlags

func ParseTemplateFlags(cmd *cobra.Command) (*TemplateSettings, error)

func (*TemplateSettings) AddMiddlewares

func (tf *TemplateSettings) AddMiddlewares(of formatters.OutputFormatter) error

func (*TemplateSettings) UpdateWithSelectSettings

func (tf *TemplateSettings) UpdateWithSelectSettings(ss *SelectSettings)

Jump to

Keyboard shortcuts

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