It's not possible to use pages from the CLI
It would be nice to be able to get more than the default 20 results from a query when using the CLI commands.
More than nice, I think that this functionnality is a requirement and should be flagged as a bug rather than an enhancement. At our site, we're dealing with 200+ projects and we're unable to use the CLI because of this behavior.
Maybe that a new method fetch_all_pages() should be implemented and could be used in the CLI and in other objects.
A syntax like
gitlab_client.fetch_all_projects_pages(options) do |results|
# deal with the results
end
could be nice and avoid a full results buffering.
You can use pagination in the CLI by passing the options as a quoted hash:
$ gitlab users "{ per_page: 100, page: 2 }"
Ok, nice to know. Even with that, IMHO, this is not really a wanted behavior in a CLI.
For instance, in Openstack clients, when you list all the VMs that are available with nova show, you do not expect to see only the N first VMs, then have to increment a page and query again.
I think that a CLI should return all the results (even if behind the scene multiple requests have to be made).
I just can't imagine something like for page in {1..100}; do gitlab users "{per_page: 42, page: ${page}}". Every CLI users would have to develop their own alias or function wrapper on top of that CLI to only fetch all the results.
This is not really that hard to modify the CLI behavior, (especially if a mechanism such as a gitlab_client.fetch_all_OBJECTS_pages() exists) and I think it's worth the effort.
@riton you can't fetch all records with GitLab API (max is 100 per page).
Anyway loading all records to terminal doesn't make a sense. Better implementation is to allow pagination via keys N (next), P (prev) or space. Feel free to open a new issue if you'd like to discuss further.