Fixed issue with generate and added some documentation to funcs
This commit is contained in:
parent
7494468bed
commit
cd840b2bf0
9 changed files with 219 additions and 158 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
byTarget bool
|
||||
pluginDirs []string
|
||||
generators map[string]generator.Generator
|
||||
)
|
||||
|
|
@ -17,6 +18,7 @@ var (
|
|||
var inspectCmd = &cobra.Command{
|
||||
Use: "inspect",
|
||||
Short: "Inspect generator plugin information",
|
||||
Long: "The 'inspect' sub-command takes a list of directories and prints all found plugin information.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
// load specific plugins from positional args
|
||||
generators = make(map[string]generator.Generator)
|
||||
|
|
@ -26,6 +28,10 @@ var inspectCmd = &cobra.Command{
|
|||
fmt.Printf("failed to load plugin at path '%s': %v\n", path, err)
|
||||
continue
|
||||
}
|
||||
// path is directory, so no plugin is loaded, but no error was returned
|
||||
if gen == nil {
|
||||
continue
|
||||
}
|
||||
generators[path] = gen
|
||||
}
|
||||
|
||||
|
|
@ -59,5 +65,6 @@ var inspectCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
inspectCmd.Flags().BoolVar(&byTarget, "by-target", false, "set whether to ")
|
||||
rootCmd.AddCommand(inspectCmd)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue