diff --git a/src/cli/commands/drift.rs b/src/cli/commands/drift.rs index de85018..e656f3a 100644 --- a/src/cli/commands/drift.rs +++ b/src/cli/commands/drift.rs @@ -382,7 +382,7 @@ fn extract_drift_topics(description: &str, notes: &[NoteRow], drift_idx: usize) } let mut sorted: Vec<(String, usize)> = freq.into_iter().collect(); - sorted.sort_by(|a, b| b.1.cmp(&a.1)); + sorted.sort_by_key(|b| std::cmp::Reverse(b.1)); sorted .into_iter() diff --git a/src/cli/commands/who/mod.rs b/src/cli/commands/who/mod.rs index 6495621..b880d5c 100644 --- a/src/cli/commands/who/mod.rs +++ b/src/cli/commands/who/mod.rs @@ -143,6 +143,8 @@ pub fn run_who(config: &Config, args: &WhoArgs) -> Result { "none" }; + let limit = args.limit.map_or(usize::MAX, usize::from); + match mode { WhoMode::Expert { path } => { // Compute as_of first so --since durations are relative to it. @@ -159,7 +161,6 @@ pub fn run_who(config: &Config, args: &WhoArgs) -> Result { } else { resolve_since_from(args.since.as_deref(), "24m", as_of_ms)? }; - let limit = usize::from(args.limit); let result = expert::query_expert( &conn, &path, @@ -191,7 +192,7 @@ pub fn run_who(config: &Config, args: &WhoArgs) -> Result { .as_deref() .map(resolve_since_required) .transpose()?; - let limit = usize::from(args.limit); + let result = workload::query_workload( &conn, username, @@ -231,7 +232,7 @@ pub fn run_who(config: &Config, args: &WhoArgs) -> Result { } WhoMode::Active => { let since_ms = resolve_since(args.since.as_deref(), "7d")?; - let limit = usize::from(args.limit); + let result = active::query_active(&conn, project_id, since_ms, limit, args.include_closed)?; Ok(WhoRun { @@ -249,7 +250,7 @@ pub fn run_who(config: &Config, args: &WhoArgs) -> Result { } WhoMode::Overlap { path } => { let since_ms = resolve_since(args.since.as_deref(), "30d")?; - let limit = usize::from(args.limit); + let result = overlap::query_overlap(&conn, &path, project_id, since_ms, limit)?; Ok(WhoRun { resolved_input: WhoResolvedInput { diff --git a/src/cli/commands/who/reviews.rs b/src/cli/commands/who/reviews.rs index 1f5b384..f3814c1 100644 --- a/src/cli/commands/who/reviews.rs +++ b/src/cli/commands/who/reviews.rs @@ -105,7 +105,7 @@ pub(super) fn query_reviews( }) .collect(); - categories.sort_by(|a, b| b.count.cmp(&a.count)); + categories.sort_by_key(|b| std::cmp::Reverse(b.count)); Ok(ReviewsResult { username: username.to_string(), diff --git a/src/cli/commands/who/types.rs b/src/cli/commands/who/types.rs index 6418270..f6378a2 100644 --- a/src/cli/commands/who/types.rs +++ b/src/cli/commands/who/types.rs @@ -18,7 +18,7 @@ pub struct WhoResolvedInput { pub since_iso: Option, /// "default" (mode default applied), "explicit" (user provided --since), "none" (no window) pub since_mode: String, - pub limit: u16, + pub limit: Option, } /// Top-level result enum -- one variant per mode. diff --git a/src/cli/commands/who_tests.rs b/src/cli/commands/who_tests.rs index 1707963..22cc01b 100644 --- a/src/cli/commands/who_tests.rs +++ b/src/cli/commands/who_tests.rs @@ -286,7 +286,7 @@ fn test_is_file_path_discrimination() { reviews: false, since: None, project: None, - limit: 20, + limit: None, detail: false, no_detail: false, fields: None, @@ -310,7 +310,7 @@ fn test_is_file_path_discrimination() { reviews: false, since: None, project: None, - limit: 20, + limit: None, detail: false, no_detail: false, fields: None, @@ -334,7 +334,7 @@ fn test_is_file_path_discrimination() { reviews: false, since: None, project: None, - limit: 20, + limit: None, detail: false, no_detail: false, fields: None, @@ -358,7 +358,7 @@ fn test_is_file_path_discrimination() { reviews: true, since: None, project: None, - limit: 20, + limit: None, detail: false, no_detail: false, fields: None, @@ -382,7 +382,7 @@ fn test_is_file_path_discrimination() { reviews: false, since: None, project: None, - limit: 20, + limit: None, detail: false, no_detail: false, fields: None, @@ -406,7 +406,7 @@ fn test_is_file_path_discrimination() { reviews: false, since: None, project: None, - limit: 20, + limit: None, detail: false, no_detail: false, fields: None, @@ -431,7 +431,7 @@ fn test_detail_rejected_outside_expert_mode() { reviews: false, since: None, project: None, - limit: 20, + limit: None, detail: true, no_detail: false, fields: None, @@ -460,7 +460,7 @@ fn test_detail_allowed_in_expert_mode() { reviews: false, since: None, project: None, - limit: 20, + limit: None, detail: true, no_detail: false, fields: None, diff --git a/src/cli/render.rs b/src/cli/render.rs index c29b97e..a833983 100644 --- a/src/cli/render.rs +++ b/src/cli/render.rs @@ -448,6 +448,15 @@ impl Theme { Style::new() } } + + /// Apply semantic color to a stage-completion icon glyph. + pub fn color_icon(icon: &str, has_errors: bool) -> String { + if has_errors { + Self::warning().render(icon) + } else { + Self::success().render(icon) + } + } } // ─── Shared Formatters ───────────────────────────────────────────────────────