Documentation ¶
Index ¶
- func AddCommandsToRootCommand(rootCmd *cobra.Command, commands []cmds.Command, aliases []*cmds.CommandAlias) error
- func AddGlazedProcessorFlagsToCobraCommand(cmd *cobra.Command, defaults interface{}) error
- func BuildCobraCommand(s cmds.Command) (*cobra.Command, error)
- func BuildCobraCommandAlias(alias *cmds.CommandAlias) (*cobra.Command, error)
- func CreateGlazedProcessorFromCobra(cmd *cobra.Command) (*cmds.GlazeProcessor, formatters.OutputFormatter, error)
- func GatherParametersFromCobraCommand(cmd *cobra.Command, description *cmds.CommandDescription, args []string) (map[string]interface{}, error)
- func SetupProcessor(ps map[string]interface{}) (*cmds.GlazeProcessor, formatters.OutputFormatter, error)
- type FieldsFilterFlagsDefaults
- type FieldsFilterSettings
- type FieldsFiltersParameterLayer
- type GlazedParameterLayers
- func (g *GlazedParameterLayers) AddFlag(*parameters.ParameterDefinition)
- func (g *GlazedParameterLayers) AddFlagsToCobraCommand(cmd *cobra.Command, defaults interface{}) error
- func (g *GlazedParameterLayers) GetDescription() string
- func (g *GlazedParameterLayers) GetName() string
- func (g *GlazedParameterLayers) GetParameterDefinitions() map[string]*parameters.ParameterDefinition
- func (g *GlazedParameterLayers) GetSlug() string
- func (g *GlazedParameterLayers) InitializeParameterDefaultsFromStruct(s interface{}) error
- func (g *GlazedParameterLayers) InitializeStructFromParameterDefaults(interface{}) error
- func (g *GlazedParameterLayers) ParseFlagsFromCobraCommand(cmd *cobra.Command) (map[string]interface{}, error)
- type OutputFlagsDefaults
- type OutputFormatterSettings
- type OutputParameterLayer
- type RenameFlagsDefaults
- type RenameParameterLayer
- type RenameSettings
- type ReplaceFlagsDefaults
- type ReplaceParameterLayer
- type ReplaceSettings
- type SelectFlagsDefaults
- type SelectParameterLayer
- type SelectSettings
- type TemplateFlagsDefaults
- type TemplateFormatterSettings
- type TemplateParameterLayer
- type TemplateSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommandsToRootCommand ¶ added in v0.2.10
func AddGlazedProcessorFlagsToCobraCommand ¶ added in v0.2.10
func BuildCobraCommand ¶ added in v0.2.10
func BuildCobraCommandAlias ¶ added in v0.2.10
func BuildCobraCommandAlias(alias *cmds.CommandAlias) (*cobra.Command, error)
func CreateGlazedProcessorFromCobra ¶ added in v0.2.10
func CreateGlazedProcessorFromCobra(cmd *cobra.Command) ( *cmds.GlazeProcessor, formatters.OutputFormatter, error, )
CreateGlazedProcessorFromCobra is a helper for cobra centric apps that quickly want to add the glazed processing layer.
If you are more serious about using glazed, consider using the `cmds.Command` and `parameters.ParameterDefinition` abstraction to define your CLI applications, which allows you to use layers and other nice features of the glazed ecosystem.
If so, use SetupProcessor instead, and create a proper glazed.Command for your command.
func GatherParametersFromCobraCommand ¶ added in v0.2.10
func GatherParametersFromCobraCommand( cmd *cobra.Command, description *cmds.CommandDescription, args []string, ) (map[string]interface{}, error)
GatherParametersFromCobraCommand takes a cobra command, an argument list as well as a description of the command, and returns a list of parsed parameters as a hashmap. It does so by parsing both the flags and the positional arguments.
func SetupProcessor ¶
func SetupProcessor(ps map[string]interface{}) ( *cmds.GlazeProcessor, formatters.OutputFormatter, error, )
Types ¶
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(ps map[string]interface{}) (*FieldsFilterSettings, error)
func (*FieldsFilterSettings) AddMiddlewares ¶
func (ffs *FieldsFilterSettings) AddMiddlewares(of formatters.OutputFormatter)
func (*FieldsFilterSettings) UpdateWithSelectSettings ¶
func (ffs *FieldsFilterSettings) UpdateWithSelectSettings(ss *SelectSettings)
type FieldsFiltersParameterLayer ¶ added in v0.2.10
type FieldsFiltersParameterLayer struct { layers.ParameterLayerImpl Defaults *FieldsFilterFlagsDefaults }
func NewFieldsFiltersParameterLayer ¶ added in v0.2.10
func NewFieldsFiltersParameterLayer() (*FieldsFiltersParameterLayer, error)
func (*FieldsFiltersParameterLayer) AddFlagsToCobraCommand ¶ added in v0.2.10
func (f *FieldsFiltersParameterLayer) AddFlagsToCobraCommand(cmd *cobra.Command, defaults interface{}) error
func (*FieldsFiltersParameterLayer) ParseFlagsFromCobraCommand ¶ added in v0.2.10
func (f *FieldsFiltersParameterLayer) ParseFlagsFromCobraCommand(cmd *cobra.Command) (map[string]interface{}, error)
type GlazedParameterLayers ¶ added in v0.2.10
type GlazedParameterLayers struct { FieldsFiltersParameterLayer *FieldsFiltersParameterLayer OutputParameterLayer *OutputParameterLayer RenameParameterLayer *RenameParameterLayer ReplaceParameterLayer *ReplaceParameterLayer SelectParameterLayer *SelectParameterLayer TemplateParameterLayer *TemplateParameterLayer }
func NewGlazedParameterLayers ¶ added in v0.2.10
func NewGlazedParameterLayers() (*GlazedParameterLayers, error)
func (*GlazedParameterLayers) AddFlag ¶ added in v0.2.10
func (g *GlazedParameterLayers) AddFlag(*parameters.ParameterDefinition)
func (*GlazedParameterLayers) AddFlagsToCobraCommand ¶ added in v0.2.10
func (g *GlazedParameterLayers) AddFlagsToCobraCommand(cmd *cobra.Command, defaults interface{}) error
func (*GlazedParameterLayers) GetDescription ¶ added in v0.2.13
func (g *GlazedParameterLayers) GetDescription() string
func (*GlazedParameterLayers) GetName ¶ added in v0.2.13
func (g *GlazedParameterLayers) GetName() string
func (*GlazedParameterLayers) GetParameterDefinitions ¶ added in v0.2.10
func (g *GlazedParameterLayers) GetParameterDefinitions() map[string]*parameters.ParameterDefinition
func (*GlazedParameterLayers) GetSlug ¶ added in v0.2.13
func (g *GlazedParameterLayers) GetSlug() string
func (*GlazedParameterLayers) InitializeParameterDefaultsFromStruct ¶ added in v0.2.13
func (g *GlazedParameterLayers) InitializeParameterDefaultsFromStruct(s interface{}) error
func (*GlazedParameterLayers) InitializeStructFromParameterDefaults ¶ added in v0.2.13
func (g *GlazedParameterLayers) InitializeStructFromParameterDefaults(interface{}) error
func (*GlazedParameterLayers) ParseFlagsFromCobraCommand ¶ added in v0.2.10
func (g *GlazedParameterLayers) ParseFlagsFromCobraCommand(cmd *cobra.Command) (map[string]interface{}, error)
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"` }
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(ps map[string]interface{}) (*OutputFormatterSettings, error)
func (*OutputFormatterSettings) CreateOutputFormatter ¶
func (ofs *OutputFormatterSettings) CreateOutputFormatter() (formatters.OutputFormatter, error)
func (*OutputFormatterSettings) UpdateWithSelectSettings ¶
func (ofs *OutputFormatterSettings) UpdateWithSelectSettings(ss *SelectSettings)
type OutputParameterLayer ¶ added in v0.2.10
type OutputParameterLayer struct { layers.ParameterLayerImpl Defaults *OutputFlagsDefaults }
func NewOutputParameterLayer ¶ added in v0.2.10
func NewOutputParameterLayer() (*OutputParameterLayer, error)
func (*OutputParameterLayer) AddFlagsToCobraCommand ¶ added in v0.2.10
func (opl *OutputParameterLayer) AddFlagsToCobraCommand(cmd *cobra.Command, s interface{}) error
type RenameFlagsDefaults ¶
type RenameParameterLayer ¶ added in v0.2.10
type RenameParameterLayer struct { layers.ParameterLayerImpl Defaults *RenameFlagsDefaults }
func NewRenameParameterLayer ¶ added in v0.2.10
func NewRenameParameterLayer() (*RenameParameterLayer, error)
func (*RenameParameterLayer) AddFlagsToCobraCommand ¶ added in v0.2.10
func (r *RenameParameterLayer) AddFlagsToCobraCommand(cmd *cobra.Command, s interface{}) error
type RenameSettings ¶
type RenameSettings struct { RenameFields map[types.FieldName]string RenameRegexps middlewares.RegexpReplacements YamlFile string }
func NewRenameSettingsFromParameters ¶ added in v0.2.10
func NewRenameSettingsFromParameters(ps map[string]interface{}) (*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 `glazed.parameter:"replace-file"` }
type ReplaceParameterLayer ¶ added in v0.2.10
type ReplaceParameterLayer struct { layers.ParameterLayerImpl Defaults *ReplaceFlagsDefaults }
func NewReplaceParameterLayer ¶ added in v0.2.10
func NewReplaceParameterLayer() (*ReplaceParameterLayer, error)
type ReplaceSettings ¶
type ReplaceSettings struct {
ReplaceFile string `glazed.parameter:"replace-file"`
}
func NewReplaceSettingsFromParameters ¶ added in v0.2.9
func NewReplaceSettingsFromParameters(ps map[string]interface{}) (*ReplaceSettings, error)
func (*ReplaceSettings) AddMiddlewares ¶
func (rs *ReplaceSettings) AddMiddlewares(of formatters.OutputFormatter) error
type SelectFlagsDefaults ¶
type SelectParameterLayer ¶ added in v0.2.10
type SelectParameterLayer struct { layers.ParameterLayerImpl Defaults *SelectFlagsDefaults }
func NewSelectParameterLayer ¶ added in v0.2.10
func NewSelectParameterLayer() (*SelectParameterLayer, error)
func (*SelectParameterLayer) AddFlagsToCobraCommand ¶ added in v0.2.10
func (s *SelectParameterLayer) AddFlagsToCobraCommand(cmd *cobra.Command, defaults interface{}) error
type SelectSettings ¶
type SelectSettings struct { SelectField string `glazed.parameter:"select"` SelectTemplate string `glazed.parameter:"select-template"` }
func NewSelectSettingsFromParameters ¶ added in v0.2.9
func NewSelectSettingsFromParameters(ps map[string]interface{}) (*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 TemplateParameterLayer ¶ added in v0.2.10
type TemplateParameterLayer struct { layers.ParameterLayerImpl Defaults *TemplateFlagsDefaults }
func NewTemplateParameterLayer ¶ added in v0.2.10
func NewTemplateParameterLayer() (*TemplateParameterLayer, error)
func (*TemplateParameterLayer) AddFlagsToCobraCommand ¶ added in v0.2.10
func (t *TemplateParameterLayer) AddFlagsToCobraCommand(cmd *cobra.Command, defaults interface{}) error
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 (*TemplateSettings) AddMiddlewares ¶
func (tf *TemplateSettings) AddMiddlewares(of formatters.OutputFormatter) error
func (*TemplateSettings) UpdateWithSelectSettings ¶
func (tf *TemplateSettings) UpdateWithSelectSettings(ss *SelectSettings)