diff --git a/src/commands/comments.rs b/src/commands/comments.rs index 4003911..ca1b414 100644 --- a/src/commands/comments.rs +++ b/src/commands/comments.rs @@ -42,8 +42,12 @@ pub enum CommentsCommand { order: Option, /// Sort ascending instead of descending - #[arg(long)] + #[arg(long, conflicts_with = "descending")] ascending: bool, + + /// Sort descending (explicit counterpart to --ascending) + #[arg(long, conflicts_with = "ascending")] + descending: bool, }, /// Get a comment by ID @@ -70,8 +74,12 @@ pub enum CommentsCommand { order: Option, /// Sort ascending instead of descending - #[arg(long)] + #[arg(long, conflicts_with = "descending")] ascending: bool, + + /// Sort descending (explicit counterpart to --ascending) + #[arg(long, conflicts_with = "ascending")] + descending: bool, }, } @@ -105,6 +113,7 @@ pub async fn execute( offset, order, ascending, + descending, } => { let request = CommentsRequest::builder() .parent_entity_type(ParentEntityType::from(entity_type)) @@ -112,7 +121,7 @@ pub async fn execute( .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .ascending(if descending { false } else { ascending }) .build(); let comments = client.comments(&request).await?; @@ -136,13 +145,14 @@ pub async fn execute( offset, order, ascending, + descending, } => { let request = CommentsByUserAddressRequest::builder() .user_address(address) .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .ascending(if descending { false } else { ascending }) .build(); let comments = client.comments_by_user_address(&request).await?; diff --git a/src/commands/events.rs b/src/commands/events.rs index d001210..2bac621 100644 --- a/src/commands/events.rs +++ b/src/commands/events.rs @@ -41,9 +41,13 @@ pub enum EventsCommand { order: Option, /// Sort ascending instead of descending - #[arg(long)] + #[arg(long, conflicts_with = "descending")] ascending: bool, + /// Sort descending (explicit counterpart to --ascending) + #[arg(long, conflicts_with = "ascending")] + descending: bool, + /// Filter by tag slug (e.g. "politics", "crypto") #[arg(long)] tag: Option, @@ -71,6 +75,7 @@ pub async fn execute(client: &gamma::Client, args: EventsArgs, output: OutputFor offset, order, ascending, + descending, tag, } => { let resolved_closed = closed.or_else(|| active.map(|a| !a)); @@ -79,7 +84,7 @@ pub async fn execute(client: &gamma::Client, args: EventsArgs, output: OutputFor .limit(limit) .maybe_closed(resolved_closed) .maybe_offset(offset) - .ascending(ascending) + .ascending(if descending { false } else { ascending }) .maybe_tag_slug(tag) // EventsRequest::order is Vec; into_iter on Option yields 0 or 1 items. .order(order.into_iter().collect()) diff --git a/src/commands/markets.rs b/src/commands/markets.rs index 2544d18..066d441 100644 --- a/src/commands/markets.rs +++ b/src/commands/markets.rs @@ -47,8 +47,12 @@ pub enum MarketsCommand { order: Option, /// Sort ascending instead of descending - #[arg(long)] + #[arg(long, conflicts_with = "descending")] ascending: bool, + + /// Sort descending (explicit counterpart to --ascending) + #[arg(long, conflicts_with = "ascending")] + descending: bool, }, /// Get a single market by ID or slug @@ -87,6 +91,7 @@ pub async fn execute( offset, order, ascending, + descending, } => { let resolved_closed = closed.or_else(|| active.map(|a| !a)); @@ -95,7 +100,7 @@ pub async fn execute( .maybe_closed(resolved_closed) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .ascending(if descending { false } else { ascending }) .build(); let markets = client.markets(&request).await?; diff --git a/src/commands/series.rs b/src/commands/series.rs index fc5e884..eaed931 100644 --- a/src/commands/series.rs +++ b/src/commands/series.rs @@ -31,9 +31,13 @@ pub enum SeriesCommand { order: Option, /// Sort ascending instead of descending - #[arg(long)] + #[arg(long, conflicts_with = "descending")] ascending: bool, + /// Sort descending (explicit counterpart to --ascending) + #[arg(long, conflicts_with = "ascending")] + descending: bool, + /// Filter by closed status #[arg(long)] closed: Option, @@ -53,13 +57,14 @@ pub async fn execute(client: &gamma::Client, args: SeriesArgs, output: OutputFor offset, order, ascending, + descending, closed, } => { let request = SeriesListRequest::builder() .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .ascending(if descending { false } else { ascending }) .maybe_closed(closed) .build(); diff --git a/src/commands/sports.rs b/src/commands/sports.rs index 0782fd1..7f3d7aa 100644 --- a/src/commands/sports.rs +++ b/src/commands/sports.rs @@ -34,9 +34,13 @@ pub enum SportsCommand { order: Option, /// Sort ascending instead of descending - #[arg(long)] + #[arg(long, conflicts_with = "descending")] ascending: bool, + /// Sort descending (explicit counterpart to --ascending) + #[arg(long, conflicts_with = "ascending")] + descending: bool, + /// Filter by league #[arg(long)] league: Option, @@ -60,13 +64,14 @@ pub async fn execute(client: &gamma::Client, args: SportsArgs, output: OutputFor offset, order, ascending, + descending, league, } => { let request = TeamsRequest::builder() .limit(limit) .maybe_offset(offset) .maybe_order(order) - .ascending(ascending) + .ascending(if descending { false } else { ascending }) .league(league.into_iter().collect()) .build(); diff --git a/src/commands/tags.rs b/src/commands/tags.rs index 64aae6a..52127a3 100644 --- a/src/commands/tags.rs +++ b/src/commands/tags.rs @@ -31,8 +31,12 @@ pub enum TagsCommand { offset: Option, /// Sort ascending instead of descending - #[arg(long)] + #[arg(long, conflicts_with = "descending")] ascending: bool, + + /// Sort descending (explicit counterpart to --ascending) + #[arg(long, conflicts_with = "ascending")] + descending: bool, }, /// Get a single tag by ID or slug @@ -68,11 +72,12 @@ pub async fn execute(client: &gamma::Client, args: TagsArgs, output: OutputForma limit, offset, ascending, + descending, } => { let request = TagsRequest::builder() .limit(limit) .maybe_offset(offset) - .ascending(ascending) + .ascending(if descending { false } else { ascending }) .build(); let tags = client.tags(&request).await?;