Skip to content

Commit cfcc1a5

Browse files
committedMar 21, 2025·
allow - as a standalone argument
1 parent feaf292 commit cfcc1a5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎ginkgo/command/command.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (c Command) Run(args []string, additionalArgs []string) {
2525
AbortWithUsage(err.Error())
2626
}
2727
for _, arg := range args {
28-
if strings.HasPrefix(arg, "-") {
28+
if len(arg) > 1 && strings.HasPrefix(arg, "-") {
2929
AbortWith(types.GinkgoErrors.FlagAfterPositionalParameter().Error())
3030
}
3131
}

‎ginkgo/command/command_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ var _ = Describe("Command", func() {
5858

5959
Context("when flags parse", func() {
6060
It("runs the command", func() {
61-
c.Run([]string{"-contrabulaturally=16", "and-an-arg", "and-another"}, []string{"additional", "-args"})
61+
c.Run([]string{"-contrabulaturally=16", "and-an-arg", "and-another", "-"}, []string{"additional", "-args"})
6262
Ω(rt).Should(HaveRun("enflabulate"))
6363

64-
Ω(rt.DataFor("enflabulate")["Args"]).Should(Equal([]string{"and-an-arg", "and-another"}))
64+
Ω(rt.DataFor("enflabulate")["Args"]).Should(Equal([]string{"and-an-arg", "and-another", "-"}))
6565
Ω(rt.DataFor("enflabulate")["AdditionalArgs"]).Should(Equal([]string{"additional", "-args"}))
6666

6767
})

0 commit comments

Comments
 (0)
Please sign in to comment.