refactor(who): make --limit optional (unlimited default) and fix clippy sort lints
Change the `who` command's --limit flag from default=20 to optional, so omitting it returns all results. This matches the behavior users expect when they want a complete expert/workload/active/overlap listing without an arbitrary cap. Also applies clippy-recommended sort improvements: - who/reviews: sort_by(|a,b| b.count.cmp(&a.count)) -> sort_by_key with Reverse - drift: same pattern for frequency sorting Adds Theme::color_icon() helper to DRY the stage-icon coloring pattern used in sync output (was inline closure, now shared method).
This commit is contained in:
@@ -143,6 +143,8 @@ pub fn run_who(config: &Config, args: &WhoArgs) -> Result<WhoRun> {
|
||||
"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<WhoRun> {
|
||||
} 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<WhoRun> {
|
||||
.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<WhoRun> {
|
||||
}
|
||||
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<WhoRun> {
|
||||
}
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user