Skip to content

Commit 7a106e2

Browse files
improve error message
1 parent d79eb49 commit 7a106e2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pkg/cmd/release/create/create.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package create
22

33
import (
44
"bytes"
5+
"errors"
56
"fmt"
67
"io/ioutil"
78
"net/http"
@@ -76,7 +77,13 @@ func NewCmdCreate(f *cmdutil.Factory, runF func(*CreateOptions) error) *cobra.Co
7677
# upload a release asset with a display label
7778
$ gh release create v1.2.3 '/path/to/asset.zip#My display label'
7879
`),
79-
Args: cobra.MinimumNArgs(1),
80+
Args: func(cmd *cobra.Command, args []string) error {
81+
if len(args) > 0 {
82+
return nil
83+
}
84+
85+
return &cmdutil.FlagError{Err: errors.New("could not create: no tag name provided")}
86+
},
8087
RunE: func(cmd *cobra.Command, args []string) error {
8188
// support `-R, --repo` override
8289
opts.BaseRepo = f.BaseRepo

pkg/cmd/release/create/create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func Test_NewCmdCreate(t *testing.T) {
158158
name: "no arguments",
159159
args: "",
160160
isTTY: true,
161-
wantErr: "requires at least 1 arg(s), only received 0",
161+
wantErr: "could not create: no tag name provided",
162162
},
163163
}
164164
for _, tt := range tests {

0 commit comments

Comments
 (0)