Skip to content

Commit

Permalink
Add limit and afterId flags to query cmd (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
akajla09 committed Oct 11, 2023
1 parent 87c7666 commit 3b266e9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/cmd/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ import (
)

var queryWarrantToken string
var queryLimit int
var queryAfterId string

func init() {
queryCmd.Flags().StringVarP(&queryWarrantToken, "warrant-token", "w", "", "optional warrant token header value to include in query request")
queryCmd.Flags().IntVarP(&queryLimit, "limit", "l", 0, "optional query result set limit")
queryCmd.Flags().StringVar(&queryAfterId, "afterId", "", "optional afterId to include for paginating result set")

rootCmd.AddCommand(queryCmd)
}
Expand All @@ -44,6 +48,13 @@ warrant query 'select explicit *'`,
WarrantToken: queryWarrantToken,
}
}
if queryLimit > 0 {
queryParams.Limit = queryLimit
}
if queryAfterId != "" {
queryParams.AfterId = queryAfterId
}

result, err := warrant.Query(args[0], &warrant.QueryParams{})
if err != nil {
return err
Expand Down

0 comments on commit 3b266e9

Please sign in to comment.