Prints a summary of all available help topics.
(&self, topics: &Topics, pager: &mut Pager<'_>)
| 449 | |
| 450 | /// Prints a summary of all available help topics. |
| 451 | async fn summary(&self, topics: &Topics, pager: &mut Pager<'_>) -> io::Result<()> { |
| 452 | for line in header() { |
| 453 | refill_and_page(pager, [&line], "").await?; |
| 454 | } |
| 455 | |
| 456 | let previous = pager.color(); |
| 457 | |
| 458 | pager.print("").await?; |
| 459 | pager.set_color(Some(TITLE_COLOR), previous.1)?; |
| 460 | refill_and_page(pager, ["Top-level help topics"], " ").await?; |
| 461 | pager.set_color(previous.0, previous.1)?; |
| 462 | pager.print("").await?; |
| 463 | for topic in topics.values() { |
| 464 | if topic.show_in_summary() { |
| 465 | // TODO(jmmv): Should use refill_and_page but continuation lines need special |
| 466 | // handling to be indented properly. |
| 467 | pager.write(" >> ")?; |
| 468 | pager.set_color(Some(LINK_COLOR), previous.1)?; |
| 469 | pager.print(topic.title()).await?; |
| 470 | pager.set_color(previous.0, previous.1)?; |
| 471 | } |
| 472 | } |
| 473 | pager.print("").await?; |
| 474 | refill_and_page(pager, ["Type HELP followed by the name of a topic for details."], " ") |
| 475 | .await?; |
| 476 | refill_and_page( |
| 477 | pager, |
| 478 | ["Type HELP \"HELP\" for details on how to specify topic names."], |
| 479 | " ", |
| 480 | ) |
| 481 | .await?; |
| 482 | refill_and_page(pager, [r#"Type LOAD "DEMOS:/TOUR.BAS": RUN for a guided tour."#], " ") |
| 483 | .await?; |
| 484 | refill_and_page(pager, [r#"Type END or press CTRL+D to exit."#], " ").await?; |
| 485 | pager.print("").await?; |
| 486 | |
| 487 | Ok(()) |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | #[async_trait(?Send)] |
no test coverage detected