(
target: &str,
callers: &[atomic_repository::repository::Caller],
json: bool,
)
| 1420 | } |
| 1421 | |
| 1422 | pub(crate) fn render_callers( |
| 1423 | target: &str, |
| 1424 | callers: &[atomic_repository::repository::Caller], |
| 1425 | json: bool, |
| 1426 | ) -> CliResult<()> { |
| 1427 | if json { |
| 1428 | println!( |
| 1429 | "{}", |
| 1430 | serde_json::to_string_pretty(callers).map_err(|e| CliError::Internal(e.into()))? |
| 1431 | ); |
| 1432 | } else if callers.is_empty() { |
| 1433 | println!("No callers found for '{target}'."); |
| 1434 | } else { |
| 1435 | println!("{} caller(s) of {target}:\n", callers.len()); |
| 1436 | for caller in callers { |
| 1437 | println!( |
| 1438 | " {}#{}:{}{}", |
| 1439 | caller.path, |
| 1440 | caller.name, |
| 1441 | caller.line, |
| 1442 | caller |
| 1443 | .summary |
| 1444 | .as_ref() |
| 1445 | .map(|summary| format!(" [{summary}]")) |
| 1446 | .unwrap_or_default() |
| 1447 | ); |
| 1448 | } |
| 1449 | } |
| 1450 | Ok(()) |
| 1451 | } |
| 1452 | |
| 1453 | // --------------------------------------------------------------------------- |
| 1454 | // QueryEntities — list tree-sitter entities in a file |
no test coverage detected