Replies: 4 comments
-
not sure how YAML file will work with arguments or validators. Argument definition is typically linked to some structure for example: Also introducing yaml format at this phase seems excessive. We can define structure and as bonus make it redable and writable as yaml/json later.
Oh..no! Waiting another 2ms for command execution is too much for me to handle.
Not getting it. How this will work for non golang code
Questionable. Working with untyped yaml file vs golang structure. Golang is much better
Eghm.. https://chromium.googlesource.com/external/github.com/spf13/cobra/+/HEAD/doc/md_docs.md Lets keep pros and cons for later |
Beta Was this translation helpful? Give feedback.
-
I think we need to reduce scope here as I see lots of bonuses like yaml or support for non golang executables (which surely can be implemented later) |
Beta Was this translation helpful? Give feedback.
-
Here is the basic command structure, generally command will posess these options! I need to research more by deep diving into cobra command structure, for including/excluding more options. type PluginConfig struct {
Commands []CommandConfig
}
type CommandConfig struct {
Name string
MapsTo ArgsConfig
Flags []FlagConfig
ShortDescription string
Examples string
}
type ArgsConfig struct {
Name string
Subcommand string
Args []string
}
type FlagConfig struct {
Type string
DefaultValue string
Name string
MapsTo string
Description string
Alias string
}
Okay so let's consider var InstallCmd = &cobra.Command{
Use: "install",
Short: "install a package",
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("Install command called")
args = append([]string{"add"}, args...)
fmt.Println(args)
c := exec.Command("yarn", args...)
c.Stdin = os.Stdin
c.Stdout = os.Stdout
var buf bytes.Buffer
c.Stderr = io.MultiWriter(os.Stderr, &buf)
return c.Run()
},
}
😅😅
Like internally we will always have a golang struct. I was saying here in the prespective of plugin creator. He can use the YAML to define commands, flags etc, later we can validate them while loading into host.
Absolutely the finest way!
agreed! |
Beta Was this translation helpful? Give feedback.
-
Sure. It is clear that wrapper makes that possible. Not sure if we should just talk about this at this phase :D Overall great work! |
Beta Was this translation helpful? Give feedback.
-
Wrapper POC
Provide wrapper structure without any strong dependency on Cobra. Plugin Core based of those structures build cobra command.
Architecture & Working
pros
challenges
reference - https://github.com/aerogear/charmil/blob/wrapper-poc/working-group/wrapper_poc.md
I was just playing around to figure out the issues I faced in pluginloader (issues)
So POC is still pending but I am on it
created yarn add command and embedded it into host - https://github.com/aerogear/charmil/blob/wrapper-poc/pkg/pluginloader/loader.go
Beta Was this translation helpful? Give feedback.
All reactions