...
1 package main
2
3 import (
4 "fmt"
5
6 "github.com/docker/cli/cli-plugins/manager"
7 "github.com/docker/cli/cli-plugins/plugin"
8 "github.com/docker/cli/cli/command"
9 "github.com/spf13/cobra"
10 )
11
12 func main() {
13 plugin.Run(func(dockerCli command.Cli) *cobra.Command {
14 cmd := &cobra.Command{
15 Use: "nopersistentprerun",
16 Short: "Testing without PersistentPreRun hooks",
17
18 RunE: func(cmd *cobra.Command, args []string) error {
19 cli := dockerCli.Client()
20 ping, err := cli.Ping(cmd.Context())
21 if err != nil {
22 return err
23 }
24 fmt.Println(ping.APIVersion)
25 return nil
26 },
27 }
28 return cmd
29 },
30 manager.Metadata{
31 SchemaVersion: "0.1.0",
32 Vendor: "Docker Inc.",
33 Version: "testing",
34 })
35 }
36
View as plain text