Skip to content

Commit 99cd90a

Browse files
guillaumerosendeloof
authored andcommitted
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]>
1 parent a279c3a commit 99cd90a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/compose/version.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package compose
1818

1919
import (
2020
"fmt"
21+
"strings"
2122

2223
"github.com/docker/compose/v2/cmd/formatter"
2324

@@ -52,7 +53,7 @@ func versionCommand() *cobra.Command {
5253

5354
func runVersion(opts versionOptions) {
5455
if opts.short {
55-
fmt.Println(internal.Version)
56+
fmt.Println(strings.TrimPrefix(internal.Version, "v"))
5657
return
5758
}
5859
if opts.format == formatter.JSON {

0 commit comments

Comments
 (0)