| 2178 | self.showtopic(topic, xrefs) |
| 2179 | |
| 2180 | def listmodules(self, key=''): |
| 2181 | if key: |
| 2182 | self.output.write(''' |
| 2183 | Here is a list of modules whose name or summary contains '{}'. |
| 2184 | If there are any, enter a module name to get more help. |
| 2185 | |
| 2186 | '''.format(key)) |
| 2187 | apropos(key) |
| 2188 | else: |
| 2189 | self.output.write(''' |
| 2190 | Please wait a moment while I gather a list of all available modules... |
| 2191 | |
| 2192 | ''') |
| 2193 | modules = {} |
| 2194 | def callback(path, modname, desc, modules=modules): |
| 2195 | if modname and modname[-9:] == '.__init__': |
| 2196 | modname = modname[:-9] + ' (package)' |
| 2197 | if modname.find('.') < 0: |
| 2198 | modules[modname] = 1 |
| 2199 | def onerror(modname): |
| 2200 | callback(None, modname, None) |
| 2201 | ModuleScanner().run(callback, onerror=onerror) |
| 2202 | self.list(modules.keys()) |
| 2203 | self.output.write(''' |
| 2204 | Enter any module name to get more help. Or, type "modules spam" to search |
| 2205 | for modules whose name or summary contain the string "spam". |
| 2206 | ''') |
| 2207 | |
| 2208 | help = Helper() |
| 2209 | |