Skip to content

fix(cli): keep filters in the next page command - #508

Open
pcbeingused333 wants to merge 1 commit into
hookdeck:mainfrom
pcbeingused333:fix/pagination-hint-keeps-flags
Open

pcbeingused333 wants to merge 1 commit into
hookdeck:mainfrom
pcbeingused333:fix/pagination-hint-keeps-flags

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

The command printed under "To get the next page:" is a fixed string per resource, so it drops everything the user passed. For example:

$ hookdeck gateway attempt list --event-id evt_123
...
To get the next page:
  hookdeck gateway attempt list --next <cursor>

Running the suggestion fails with --event-id is required. On other list commands it runs but silently returns an unfiltered (or differently sorted) next page, and transformation executions list loses its transformation argument.

printPaginationInfo now rebuilds the line from the command that was run: command path, positional arguments and the flags that were set, with --prev/--next replaced by the new cursor. Values that need it are single-quoted for a POSIX shell. Of the global flags only --profile and --hookdeck-config are repeated, since they select the account; the rest are left out so that --api-key/--cli-key are never echoed.

source, destination and connection list do not accept --next on main yet; that is handled separately in #501.

Tests: pkg/cmd/pagination_output_test.go runs the list commands against a stub server and checks the suggested line; all six cases fail without the change. go vet ./pkg/cmd/ and go test ./pkg/cmd/ pass.

This change was prepared with AI assistance.

The command printed under "To get the next page" was a fixed string, so it dropped the flags and arguments of the command that produced the page. For attempt list that left out the required --event-id.
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.

1 participant