Merge pull request #13097 from Bahtya/fix-limit-final
Fix infinite loop in `gh release list --limit 0`
This commit is contained in:
commit
d0558fcbaa
2 changed files with 9 additions and 0 deletions
|
|
@ -44,6 +44,10 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
|
|||
// support `-R, --repo` override
|
||||
opts.BaseRepo = f.BaseRepo
|
||||
|
||||
if opts.LimitResults < 1 {
|
||||
return cmdutil.FlagErrorf("invalid limit: %v", opts.LimitResults)
|
||||
}
|
||||
|
||||
if runF != nil {
|
||||
return runF(opts)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,11 @@ func Test_NewCmdList(t *testing.T) {
|
|||
Order: "desc",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "zero limit",
|
||||
args: "--limit 0",
|
||||
wantErr: "invalid limit: 0",
|
||||
},
|
||||
{
|
||||
name: "with order",
|
||||
args: "--order asc",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue