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: add paging flags for list commands that support paging #297

Merged
merged 4 commits into from
Apr 4, 2024

Conversation

kangasta
Copy link
Contributor

@kangasta kangasta commented Apr 2, 2024

This also increases the default page size from 10 to 100.

@kangasta kangasta marked this pull request as ready for review April 2, 2024 10:41
@kangasta kangasta requested a review from a team as a code owner April 2, 2024 10:41

func (pp *PageParameters) ConfigureFlags(fs *pflag.FlagSet) {
fs.IntVar(&pp.size, "size", 100, "Number of entries to receive at most.")
fs.IntVar(&pp.number, "page", 0, "Page number to calculate first item to receive. Page numbers start from `1`.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These could also be --page-size and --page-number to be more descriptive, but those are quite verbose 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

As they naturally are available only on list commands, these shorter ones seem fine to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was also thinking between --size and --limit. Go SDK uses size, but there that is used as field of Page struct. Maybe limit would clearer without that context 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed --size--limit

internal/paging/paging.go Show resolved Hide resolved

func (pp *PageParameters) ConfigureFlags(fs *pflag.FlagSet) {
fs.IntVar(&pp.size, "size", 100, "Number of entries to receive at most.")
fs.IntVar(&pp.number, "page", 0, "Page number to calculate first item to receive. Page numbers start from `1`.")
Copy link
Contributor

Choose a reason for hiding this comment

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

As they naturally are available only on list commands, these shorter ones seem fine to me.

@kangasta kangasta merged commit 770a0a0 into main Apr 4, 2024
7 checks passed
@kangasta kangasta deleted the feat/paging branch April 4, 2024 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants