From ed08ace9be45429daab521a810260ffd9c17f806 Mon Sep 17 00:00:00 2001 From: Harish Kotra Date: Wed, 25 Feb 2026 17:43:07 +0530 Subject: [PATCH] fix: correct sort order default to descending (#17) - Changed default sort direction from ascending to descending for markets, events, comments, and series list commands - When --ascending flag is NOT provided: sorts in descending order (default behavior) - When --ascending flag IS provided: sorts in ascending order (explicit override) - Help text already stated 'Sort ascending instead of descending', implying descending is default - Fixes issue where --ascending flag was a no-op and no way to get descending results - Simplified conditional logic using Some(ascending) instead of if/else --- src/commands/comments.rs | 4 ++-- src/commands/events.rs | 2 +- src/commands/markets.rs | 2 +- src/commands/series.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/comments.rs b/src/commands/comments.rs index 9c55fad..e5deddd 100644 --- a/src/commands/comments.rs +++ b/src/commands/comments.rs @@ -112,7 +112,7 @@ pub async fn execute( .limit(limit) .maybe_offset(offset) .maybe_order(order) - .maybe_ascending(if ascending { Some(true) } else { None }) + .maybe_ascending(Some(ascending)) .build(); let comments = client.comments(&request).await?; @@ -150,7 +150,7 @@ pub async fn execute( .limit(limit) .maybe_offset(offset) .maybe_order(order) - .maybe_ascending(if ascending { Some(true) } else { None }) + .maybe_ascending(Some(ascending)) .build(); let comments = client.comments_by_user_address(&request).await?; diff --git a/src/commands/events.rs b/src/commands/events.rs index b5d947a..f5cb1ab 100644 --- a/src/commands/events.rs +++ b/src/commands/events.rs @@ -79,7 +79,7 @@ pub async fn execute(client: &gamma::Client, args: EventsArgs, output: OutputFor .limit(limit) .maybe_closed(resolved_closed) .maybe_offset(offset) - .maybe_ascending(if ascending { Some(true) } else { None }) + .maybe_ascending(Some(ascending)) .maybe_tag_slug(tag) .order(order.into_iter().collect::>()) .build(); diff --git a/src/commands/markets.rs b/src/commands/markets.rs index 68e5491..d3ee17f 100644 --- a/src/commands/markets.rs +++ b/src/commands/markets.rs @@ -95,7 +95,7 @@ pub async fn execute( .maybe_closed(resolved_closed) .maybe_offset(offset) .maybe_order(order) - .maybe_ascending(if ascending { Some(true) } else { None }) + .maybe_ascending(Some(ascending)) .build(); let markets = client.markets(&request).await?; diff --git a/src/commands/series.rs b/src/commands/series.rs index 11dba91..e4d8bdf 100644 --- a/src/commands/series.rs +++ b/src/commands/series.rs @@ -59,7 +59,7 @@ pub async fn execute(client: &gamma::Client, args: SeriesArgs, output: OutputFor .limit(limit) .maybe_offset(offset) .maybe_order(order) - .maybe_ascending(if ascending { Some(true) } else { None }) + .maybe_ascending(Some(ascending)) .maybe_closed(closed) .build();