From 4ef1af4e3d287d589b1d88d567d139580fd0b5a9 Mon Sep 17 00:00:00 2001 From: Michael Schuett Date: Mon, 4 Mar 2019 18:32:34 -0500 Subject: [PATCH] Fix issue with setting limit This was causing queries that set limit before to always return the default of 10 which is the page size when not set. --- src/query.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/query.go b/src/query.go index 159f5b8..bf9b5d1 100644 --- a/src/query.go +++ b/src/query.go @@ -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. @@ -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, } }