Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetParentsFromDir ¶
GetParentsFromDir is a helper function to simply return a list of parent verbs for applications loaded from declarative yaml files. The directory structure mirrors the verb structure in cobra.
Types ¶
type FSCommandLoader ¶
type FSCommandLoader interface {
LoadCommandsFromFS(f fs.FS, dir string, options []cmds.CommandDescriptionOption, aliasOptions []alias.Option) ([]cmds.Command, []*alias.CommandAlias, error)
}
FSCommandLoader is an interface that describes the most generic loader type, which is then used to load commands and command aliases from embedded queries and from "repository" directories used by glazed.
Examples of this pattern are used in sqleton, escuse-me and pinocchio.
type ReaderCommandLoader ¶ added in v0.2.69
type YAMLCommandLoader ¶
type YAMLCommandLoader interface { LoadCommandFromYAML(s io.Reader, options ...cmds.CommandDescriptionOption) ([]cmds.Command, error) LoadCommandAliasFromYAML(s io.Reader, options ...alias.Option) ([]*alias.CommandAlias, error) }
YAMLCommandLoader is an interface that allows an application using the glazed library to loader commands from YAML files.
type YAMLFSCommandLoader ¶
type YAMLFSCommandLoader struct {
// contains filtered or unexported fields
}
YAMLFSCommandLoader walks a FS and finds all yaml files, loading them using the passed YAMLCommandLoader.
It handles the following generic functionality: - recursive FS walking - setting SourceName for each command - setting Parents for each command
func NewYAMLFSCommandLoader ¶
func NewYAMLFSCommandLoader( loader YAMLCommandLoader, ) *YAMLFSCommandLoader
func (*YAMLFSCommandLoader) LoadCommandsFromFS ¶
func (l *YAMLFSCommandLoader) LoadCommandsFromFS(f fs.FS, dir string, options []cmds.CommandDescriptionOption, aliasOptions []alias.Option) ([]cmds.Command, []*alias.CommandAlias, error)
LoadCommandsFromFS walks the FS and loads all commands and command aliases found.
TODO(manuel, 2023-03-16) Add loading of helpsystem files See https://github.com/go-go-golems/glazed/issues/55 See https://github.com/go-go-golems/glazed/issues/218
type YAMLReaderCommandLoader ¶ added in v0.2.69
type YAMLReaderCommandLoader struct {
YAMLCommandLoader
}
func YAMLReaderCommandLoaderFromYAMLCommandLoader ¶ added in v0.2.69
func YAMLReaderCommandLoaderFromYAMLCommandLoader(loader YAMLCommandLoader) *YAMLReaderCommandLoader
func (*YAMLReaderCommandLoader) LoadCommandsFromReader ¶ added in v0.2.69
func (l *YAMLReaderCommandLoader) LoadCommandsFromReader(r io.Reader, options []cmds.CommandDescriptionOption, aliasOptions []alias.Option) ([]cmds.Command, error)