Add pagination helpers

Add some pagination helpers to configure pagination parameters for
various commands. Two pagination schemes are supported, based on what we
currently support across OSC commands: marker-based pagination and
offset-based pagination.

Change-Id: I551bb4c3ff0568c6df5244a1d0f0669497bee58f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane
2021-07-27 11:00:06 +01:00
committed by Stephen Finucane
parent 8b253cbda8
commit c7e3529dea
17 changed files with 115 additions and 247 deletions

View File

@@ -27,6 +27,7 @@ from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
from openstackclient.common import pagination
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
@@ -296,15 +297,7 @@ class ListKeypair(command.Lister):
),
)
identity_common.add_project_domain_option_to_parser(parser)
parser.add_argument(
'--marker',
help=_('The last keypair ID of the previous page'),
)
parser.add_argument(
'--limit',
type=int,
help=_('Maximum number of keypairs to display'),
)
pagination.add_marker_pagination_option_to_parser(parser)
return parser
def take_action(self, parsed_args):