r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
646 stars 57 forks source link

Add size control in `pkg_search()` #506

Closed olivroy closed 1 year ago

olivroy commented 1 year ago

Fix #505

This is an attempt to fix the issue.

Let me know how to add tests.

My ad-hoc testing was

pkg_search("gist")
# 'gist' -- hits 1-4 of 4
pkg_search("git")
# 'git' -- hits 1-10 of 52
pkg_search("git", from = 2)
# 'git' -- hits 2-11 of 52
pkg_search("gist", from = 2)
# 'gist' -- hits 2-4 of 4
pkg_search("git", from = 2, size = 9)
# 'git' -- hits 2-10 of 52
 pkg_search("gist", from = 5)
x No result. :(
 pkg_search("git", from = 50)
# 'git' -- hits 50-52 of 52
gaborcsardi commented 1 year ago

Very cool, thanks a lot!