Documentation ¶
Index ¶
- func FileNameToFsFilePath(fileName string) (fs.FS, string, error)
- func GetParentsFromDir(dir string) []string
- func LoadCommandAliasFromYAML(s io.Reader, options ...alias.Option) ([]*alias.CommandAlias, error)
- func LoadCommandOrAliasFromReader(r io.Reader, rawLoadCommand LoadReaderCommandFunc, ...) ([]cmds.Command, error)
- func LoadCommandsFromFS(f fs.FS, dir string, source string, loader CommandLoader, ...) ([]cmds.Command, error)
- type CommandLoader
- type LoadReaderCommandFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileNameToFsFilePath ¶ added in v0.4.35
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.
func LoadCommandOrAliasFromReader ¶ added in v0.4.34
func LoadCommandOrAliasFromReader( r io.Reader, rawLoadCommand LoadReaderCommandFunc, options []cmds.CommandDescriptionOption, aliasOptions []alias.Option, ) ([]cmds.Command, error)
func LoadCommandsFromFS ¶ added in v0.4.35
func LoadCommandsFromFS( f fs.FS, dir string, source string, loader CommandLoader, options []cmds.CommandDescriptionOption, aliasOptions []alias.Option, ) ([]cmds.Command, 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
Types ¶
type CommandLoader ¶ added in v0.4.35
type CommandLoader interface { LoadCommands( f fs.FS, entryName string, options []cmds.CommandDescriptionOption, aliasOptions []alias.Option, ) ([]cmds.Command, error) IsFileSupported(f fs.FS, fileName string) bool }
CommandLoader 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.