Skip to content

Commit a6c3acc

Browse files
authored
Merge pull request #1802 from gtardif/fix_docker_agent_standalone_version
Fix docker-agent version for cli plugin & standalone exec
2 parents 3ee027a + edf2a4f commit a6c3acc

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cmd/root/version.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package root
22

33
import (
4+
"github.com/docker/cli/cli-plugins/plugin"
45
"github.com/spf13/cobra"
56

67
"github.com/docker/cagent/pkg/cli"
@@ -22,6 +23,14 @@ func runVersionCommand(cmd *cobra.Command, args []string) {
2223
telemetry.TrackCommand("version", args)
2324

2425
out := cli.NewPrinter(cmd.OutOrStdout())
25-
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)
2635
out.Printf("Commit: %s\n", version.Commit)
2736
}

0 commit comments

Comments
 (0)