MCPcopy Index your code
hub / github.com/endbasic/endbasic / describe

Method describe

std/src/help.rs:91–138  ·  view source on GitHub ↗
(&self, pager: &mut Pager<'_>)

Source from the content-addressed store, hash-verified

89 }
90
91 async fn describe(&self, pager: &mut Pager<'_>) -> io::Result<()> {
92 pager.print("").await?;
93 let previous = pager.color();
94 pager.set_color(Some(TITLE_COLOR), previous.1)?;
95 match self.metadata.return_type() {
96 None => {
97 if self.metadata.is_argless() {
98 refill_and_page(pager, [self.metadata.name()], " ").await?;
99 } else {
100 refill_and_page(
101 pager,
102 [&format!("{} {}", self.metadata.name(), self.metadata.syntax())],
103 " ",
104 )
105 .await?;
106 }
107 }
108 Some(return_type) => {
109 if self.metadata.is_argless() {
110 refill_and_page(
111 pager,
112 [&format!("{}{}", self.metadata.name(), return_type.annotation(),)],
113 " ",
114 )
115 .await?;
116 } else {
117 refill_and_page(
118 pager,
119 [&format!(
120 "{}{}({})",
121 self.metadata.name(),
122 return_type.annotation(),
123 self.metadata.syntax(),
124 )],
125 " ",
126 )
127 .await?;
128 }
129 }
130 }
131 pager.set_color(previous.0, previous.1)?;
132 if !self.metadata.description().count() > 0 {
133 pager.print("").await?;
134 refill_and_page(pager, self.metadata.description(), " ").await?;
135 }
136 pager.print("").await?;
137 Ok(())
138 }
139}
140
141/// Generates the index for a collection of `CallableMetadata`s to use in a `CategoryTopic`.

Callers 1

async_execMethod · 0.45

Calls 15

refill_and_pageFunction · 0.85
return_typeMethod · 0.80
is_arglessMethod · 0.80
descriptionMethod · 0.80
peekableMethod · 0.80
iterMethod · 0.80
printMethod · 0.45
colorMethod · 0.45
set_colorMethod · 0.45
nameMethod · 0.45
lenMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected