瀏覽代碼

Return only numbers in short version

Python version of docker compose removes the v prefix in the version.

```
$ docker-compose version --short
1.25.5
```

Signed-off-by: Guillaume Rose <[email protected]>
Guillaume Rose 3 年之前
父節點
當前提交
99cd90a4b2
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      cmd/compose/version.go

+ 2 - 1
cmd/compose/version.go

@@ -18,6 +18,7 @@ package compose
 
 import (
 	"fmt"
+	"strings"
 
 	"github.com/docker/compose/v2/cmd/formatter"
 
@@ -52,7 +53,7 @@ func versionCommand() *cobra.Command {
 
 func runVersion(opts versionOptions) {
 	if opts.short {
-		fmt.Println(internal.Version)
+		fmt.Println(strings.TrimPrefix(internal.Version, "v"))
 		return
 	}
 	if opts.format == formatter.JSON {