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

Function text

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

Source from the content-addressed store, hash-verified

190}
191
192fn text<'a, 'b>(
193 mut o: impl Write + 'b,
194 state: &'b mut ParseState,
195) -> impl FnMut(&mut Partial<&'a str>) -> PResult<(), Error<'a>> + 'b {
196 move |i| {
197 let content = take_while(1.., |t| AsChar::is_alphanum(t) || "+,.!?\"".contains(t)).parse_next(i)?;
198 if state.is_first_line {
199 state.is_first_line = false;
200 // The extra space here is reserved for the prompt pointer ("> ").
201 // Essentially we want the input to wrap as if the prompt pointer is a part of it
202 // but only display what is received.
203 queue_newline_or_advance(&mut o, state, content.width() + 2)?;
204 } else {
205 queue_newline_or_advance(&mut o, state, content.width())?;
206 }
207 queue(&mut o, style::Print(content))?;
208
209 Ok(())
210 }
211}
212
213fn heading<'a, 'b>(
214 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