2018-12-10 15:30:19 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/docker/cli/cli-plugins/manager"
|
|
|
|
"github.com/docker/cli/cli-plugins/plugin"
|
|
|
|
"github.com/docker/cli/cli/command"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
plugin.Run(func(dockerCli command.Cli) *cobra.Command {
|
|
|
|
goodbye := &cobra.Command{
|
|
|
|
Use: "goodbye",
|
|
|
|
Short: "Say Goodbye instead of Hello",
|
|
|
|
Run: func(cmd *cobra.Command, _ []string) {
|
|
|
|
fmt.Fprintln(dockerCli.Out(), "Goodbye World!")
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "helloworld",
|
|
|
|
Short: "A basic Hello World plugin for tests",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
fmt.Fprintln(dockerCli.Out(), "Hello World!")
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd.AddCommand(goodbye)
|
|
|
|
return cmd
|
|
|
|
},
|
|
|
|
manager.Metadata{
|
|
|
|
SchemaVersion: "0.1.0",
|
|
|
|
Vendor: "Docker Inc.",
|
2018-12-11 14:03:47 +00:00
|
|
|
Version: "testing",
|
2018-12-10 15:30:19 +00:00
|
|
|
})
|
|
|
|
}
|