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

Function bold

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

Source from the content-addressed store, hash-verified

323}
324
325fn bold<'a, 'b>(
326 mut o: impl Write + 'b,
327 state: &'b mut ParseState,
328) -> impl FnMut(&mut Partial<&'a str>) -> PResult<(), Error<'a>> + 'b {
329 move |i| {
330 match state.newline {
331 true => {
332 alt(("**", "__")).parse_next(i)?;
333 queue(&mut o, style::SetAttribute(Attribute::Bold))?;
334 },
335 false => match state.bold {
336 true => {
337 alt(("**", "__")).parse_next(i)?;
338 queue(&mut o, style::SetAttribute(Attribute::NormalIntensity))?;
339 },
340 false => {
341 preceded(space1, alt(("**", "__"))).parse_next(i)?;
342 queue(&mut o, style::Print(' '))?;
343 queue(&mut o, style::SetAttribute(Attribute::Bold))?;
344 },
345 },
346 };
347
348 state.bold = !state.bold;
349
350 Ok(())
351 }
352}
353
354fn italic<'a, 'b>(
355 mut o: impl Write + 'b,

Callers

nothing calls this directly

Calls 1

queueFunction · 0.85

Tested by

no test coverage detected