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