Skip to content

Commit d1982a9

Browse files
authored
Add --offset option to workflow list (#696)
* Add --offset and -f option to workflow list command
1 parent 97c7db5 commit d1982a9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/cli/workflow.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,13 @@ def setup_parser(parser: argparse._SubParsersAction):
259259
list_parser.add_argument('--count', '-c',
260260
default=20,
261261
type=validation.positive_integer,
262-
help='Display the given count of workflows. Default value is 20.')
262+
help='Display the given count of workflows. Default value is 20. '
263+
'Use --offset to skip results for pagination.')
264+
list_parser.add_argument('--offset', '-f',
265+
default=0,
266+
type=validation.non_negative_integer,
267+
help='Skip the first N workflows (newest first, server-side order). '
268+
'Use with --count to paginate results. Default is 0.')
263269
list_parser.add_argument('--name', '-n',
264270
type=str,
265271
help='Display workflows which contains the string.')
@@ -1030,7 +1036,7 @@ def _list_workflows(service_client: client.ServiceClient, args: argparse.Namespa
10301036
while True:
10311037
count = min(args.count - current_count, 1000)
10321038
params['limit'] = count
1033-
params['offset'] = current_count
1039+
params['offset'] = args.offset + current_count
10341040

10351041
workflow_result = service_client.request(
10361042
client.RequestMethod.GET,

0 commit comments

Comments
 (0)