MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / citation

Function citation

crates/chat-cli/src/cli/chat/parse.rs:397–412  ·  view source on GitHub ↗
(
    mut o: impl Write + 'b,
    state: &'b mut ParseState,
)

Source from the content-addressed store, hash-verified

395}
396
397fn citation<'a, 'b>(
398 mut o: impl Write + 'b,
399 state: &'b mut ParseState,
400) -> impl FnMut(&mut Partial<&'a str>) -> PResult<(), Error<'a>> + 'b {
401 move |i| {
402 let num = delimited("[[", digit1, "]]").parse_next(i)?;
403 let link = delimited("(", take_till(0.., ')'), ")").parse_next(i)?;
404
405 state.citations.push((num.to_owned(), link.to_owned()));
406
407 queue_newline_or_advance(&mut o, state, num.width() + 1)?;
408 queue(&mut o, StyledText::info_fg())?;
409 queue(&mut o, style::Print(format!("[^{num}]")))?;
410 queue(&mut o, StyledText::reset())
411 }
412}
413
414fn url<'a, 'b>(
415 mut o: impl Write + 'b,

Callers

nothing calls this directly

Calls 2

queue_newline_or_advanceFunction · 0.85
queueFunction · 0.85

Tested by

no test coverage detected