feat: add --descending flag to all list commands#26
Open
tylerthebuildor wants to merge 1 commit intoPolymarket:mainfrom
Open
feat: add --descending flag to all list commands#26tylerthebuildor wants to merge 1 commit intoPolymarket:mainfrom
tylerthebuildor wants to merge 1 commit intoPolymarket:mainfrom
Conversation
The --ascending flag was the only sort direction control, but omitting it just deferred to the API default — there was no way to explicitly request descending sort. Add a --descending counterpart (mutually exclusive via conflicts_with) so users can opt into either direction. No flag omits the parameter entirely, preserving existing behavior. Closes Polymarket#17 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
Note: #20 also addresses this issue but takes a different approach — it changes the default behavior so that omitting --ascending now sends ascending=false (descending). While that matches the original help text, it's a breaking change for anyone whose scripts rely on the current default sort order. This PR takes a backwards-compatible approach instead: add a --descending flag as the explicit counterpart. No flag still omits the parameter entirely (same API request as before), so existing workflows are unaffected. Users who want descending sort now have --descending to opt in. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The --ascending flag was the only sort direction control, but omitting it just deferred to the API default there was no way to explicitly request descending sort. Add a --descending counterpart (mutually exclusive via conflicts_with) so users can opt into either direction.
No flag omits the parameter entirely, preserving existing behavior.
Closes #17
Note
Low Risk
Low risk CLI behavior change that only affects optional sort-direction query parameters; default behavior is preserved when no flag is provided.
Overview
Adds an explicit
--descendingflag (mutually exclusive with--ascending) to all relevantlist-style commands so users can force descending sort rather than relying on API defaults.Updates request construction to derive a single optional sort-direction value (
Some(true),Some(false), orNone) and pass it throughmaybe_ascending, and adds unit tests inmarketsto verify the query string omits the parameter when unset and encodesascending=true/falsewhen either flag is used.Written by Cursor Bugbot for commit d8e4636. This will update automatically on new commits. Configure here.