Front the whole network's help through HelpServ
Each service now exposes its help catalog via Service::help_topics; the engine collects them into a network-wide index on Network, reachable through two new NetView methods. HelpServ uses it: HELP <service> [command] (or a bare service name) serves any service's per-command help, bare HELP lists the services, and its own ticket commands still work. No cross-crate dependency: the catalog flows through the SDK's NetView, keeping every module dependent only on echo-api.
This commit is contained in:
parent
69a93198ff
commit
fcca8e4e3b
17 changed files with 151 additions and 6 deletions
|
|
@ -186,9 +186,19 @@ impl Engine {
|
|||
pub fn new(services: Vec<Box<dyn Service>>, db: Db) -> Self {
|
||||
let chan_service = services.iter().find(|s| s.manages_channels()).map(|s| s.uid().to_string());
|
||||
let nick_service = services.iter().find(|s| s.manages_accounts()).map(|s| s.uid().to_string());
|
||||
// Network-wide help index: every service that publishes topics, so HelpServ
|
||||
// can front help for the whole network through NetView.
|
||||
let mut network = Network::default();
|
||||
network.help_catalog = services
|
||||
.iter()
|
||||
.filter_map(|s| {
|
||||
let (blurb, topics) = s.help_topics();
|
||||
(!topics.is_empty()).then(|| (s.nick().to_string(), blurb, topics))
|
||||
})
|
||||
.collect();
|
||||
Self {
|
||||
services,
|
||||
network: Network::default(),
|
||||
network,
|
||||
db,
|
||||
sasl_sessions: HashMap::new(),
|
||||
reg_limiter: RegLimiter::new(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue