Closed weisjohn closed 11 years ago
@weisjohn How do you feel about this implementation?
I added a new configuration: "display_lists_in_pager" and defaulted it to true. If enabled, any command that lists bulk results (gitlab projects
or gitlab snippets
) will display results in the system pager or "less." All results are returned at all times whether this configuration is true or false. The understanding being that if you choose not to use the pager you could spew hundreds of results on the screen.
I really felt there was no good way to allow a user to set a 'results per page' value and page through them. Thoughts?
I will polish this implementation and await your thoughts. I haven't merged it into master or tagged it yet. Thanks.
@drewblessing that sounds awesome to me, I love the idea of sending it to less
or whatever system pager is available. I don't know if you can determine if stdout is being redirected, but if you can, then I wouldn't send it to less
in that case...
Hmm. I'm not sure if I can do that. Are you envisioning a case where someone might call this tool from another script or automated tool? In that case, it may require them setting that configuration to false.
With that in mind, it may also be a good idea to tie this configuration setting in with the other instances where I use the system pager - viewing snippets for example.
yeah, that's precisely the case that I'm using it for, but if setting display_lists_in_pager
to false will cause the output to not go through less
than that's fine.
yes, that will completely bypass less
. In anticipation of also using this configuration with other purposes in the future, I've renamed it display_results_in_pager
.
I tagged the changes as v1.1.0.pre. If you have an opportunity would you like to test these changes for me?
Looks great! I tried both options and it works perfectly! Thanks for doing this!
Glad to hear that. I am backtracking slightly on the default configuration here. To maintain original functionality I'm going to default this new configuration to false
. I felt maintaining was important.
Also, I added some flags to allow you to override the paging on a one time basis. For example:
gitlab projects --nopager
or gitlab projects --pager
Tagged and released in v1.1.0.
Thanks again @weisjohn. I appreciate your input.
You're welcome! Thanks for soliciting it / being open to it!
When running GitLab, I see this: (I've obfuscated my project names to protect the innocent
I have access to 80 projects in GitLab, however. But I don't think there's any way to paginate.
The GitLab API by default only returns 20 objects at a time: https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/README.md#pagination