1 parent 3ee027a commit ddd0ba0Copy full SHA for ddd0ba0
1 file changed
cmd/root/version.go
@@ -6,6 +6,7 @@ import (
6
"github.com/docker/cagent/pkg/cli"
7
"github.com/docker/cagent/pkg/telemetry"
8
"github.com/docker/cagent/pkg/version"
9
+ "github.com/docker/cli/cli-plugins/plugin"
10
)
11
12
func newVersionCmd() *cobra.Command {
@@ -22,6 +23,14 @@ func runVersionCommand(cmd *cobra.Command, args []string) {
22
23
telemetry.TrackCommand("version", args)
24
25
out := cli.NewPrinter(cmd.OutOrStdout())
- out.Printf("cagent version %s\n", version.Version)
26
+
27
+ commandName := "docker-agent"
28
+ if cmd.Parent() != nil {
29
+ commandName = cmd.Parent().Name()
30
+ }
31
+ if !plugin.RunningStandalone() {
32
+ commandName = "docker " + commandName
33
34
+ out.Printf("%s version %s\n", commandName, version.Version)
35
out.Printf("Commit: %s\n", version.Commit)
36
}
0 commit comments