Skip to content

Commit

Permalink
Fix issue with setting limit
Browse files Browse the repository at this point in the history
This was causing queries that set limit before to always return the
default of 10 which is the page size when not set.
  • Loading branch information
michaeljs1990 committed Mar 4, 2019
1 parent 7f98ffb commit 4ef1af4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,12 @@ func queryRunCommand(c *cli.Context) error {
opts = append(opts, queryBuildOptions(c, hostname, fromStdin))
}

// Limit and pipe-size don't make sense to use together and will
// not do what you want so we don't allow it.
if c.IsSet("limit") && c.IsSet("pipe-size") {
logAndDie("--limit and --pipe-size can't be set at the same time")
}

// Kinda hacky but if limit is set we just set
// that as the page size and break after the first
// call to get assets.
Expand All @@ -416,8 +422,8 @@ func queryRunCommand(c *cli.Context) error {
size = c.Int("limit")
}

for _, opt := range opts {
opt.PageOpts = collins.PageOpts{
for i, _ := range opts {
opts[i].PageOpts = collins.PageOpts{
Size: size,
}
}
Expand Down

0 comments on commit 4ef1af4

Please sign in to comment.