Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce paginator options #537

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

nervo
Copy link
Contributor

@nervo nervo commented Jun 7, 2024

Introduce paginator options, to ease instanciation.

p := paginator.New(
	paginator.WithPerPage(42),
	paginator.WithTotalPages(42),
)

Only these two options has been added, but other could be easily added now that the foundations has been laid :)

Note: to be honnest, i don't know if you prefer such integration, or the "chain" one like:

p := paginator.New().WithPerPage(42).WithTotalPages(42)

I see bof of them in current charmbracelet ecosystem, just tell me :)

@nervo nervo requested a review from maaslalani as a code owner June 7, 2024 16:28
@nervo nervo force-pushed the paginator-options branch from dacb54a to 761f668 Compare June 7, 2024 16:29
@caarlos0 caarlos0 added the enhancement New feature or request label Aug 13, 2024
Copy link
Member

@meowgorithm meowgorithm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for this one and sorry to take so long to get to it, @nervo!

Also, for what it's worth, in terms of initialization, the functional argument style you implemented here is definitely the way to go (versus chaining).

@nervo nervo force-pushed the paginator-options branch from 761f668 to 88f6e7b Compare August 27, 2024 07:02
@nervo
Copy link
Contributor Author

nervo commented Aug 27, 2024

@meowgorithm i've just rebased, do you want me to add other options ?

@meowgorithm
Copy link
Member

@nervo I think this looks good. If you think it's ready I'm fine to merge this.

@nervo
Copy link
Contributor Author

nervo commented Aug 27, 2024

Let's do it \o/

@meowgorithm meowgorithm merged commit 5110925 into charmbracelet:master Aug 27, 2024
9 checks passed
@meowgorithm
Copy link
Member

Thanks for this contribution and your many others! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants