File tree 3 files changed +38
-1
lines changed 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,10 @@ Options:
62
62
63
63
var (
64
64
rootCmd = & cobra.Command {
65
- Use : filepath .Base (os .Args [0 ]) + " [options]" ,
65
+ // In shell completion, there is `.exe` suffix on Windows.
66
+ // This does not provide the same experience across platforms
67
+ // and was mentioned in [#16499](https://github.com/containers/podman/issues/16499).
68
+ Use : strings .TrimSuffix (filepath .Base (os .Args [0 ]), ".exe" ) + " [options]" ,
66
69
Long : "Manage pods, containers and images" ,
67
70
SilenceUsage : true ,
68
71
SilenceErrors : true ,
Original file line number Diff line number Diff line change
1
+ package e2e_test
2
+
3
+ type helpMachine struct {
4
+ cmd []string
5
+ }
6
+
7
+ func (i * helpMachine ) buildCmd (m * machineTestBuilder ) []string {
8
+ cmd := []string {"help" }
9
+ i .cmd = cmd
10
+ return cmd
11
+ }
Original file line number Diff line number Diff line change
1
+ package e2e_test
2
+
3
+ import (
4
+ "regexp"
5
+ "slices"
6
+
7
+ . "github.com/onsi/ginkgo/v2"
8
+ . "github.com/onsi/gomega"
9
+ . "github.com/onsi/gomega/gexec"
10
+ )
11
+
12
+ var _ = Describe ("podman help" , func () {
13
+ It ("podman usage base command is podman or podman-remote, without extension " , func () {
14
+ helpSession , err := mb .setCmd (new (helpMachine )).run ()
15
+ Expect (err ).NotTo (HaveOccurred ())
16
+ Expect (helpSession ).Should (Exit (0 ))
17
+
18
+ // Verify `.exe` suffix doesn't present in the usage command string
19
+ helpMessages := helpSession .outputToStringSlice ()
20
+ usageCmdIndex := slices .IndexFunc (helpMessages , func (helpMessage string ) bool { return helpMessage == "Usage:" }) + 1
21
+ Expect (regexp .MustCompile (`\w\.exe\b` ).MatchString (helpMessages [usageCmdIndex ])).Should (BeFalse ())
22
+ })
23
+ })
You can’t perform that action at this time.
0 commit comments