add upstream calendars page
This commit is contained in:
parent
830f45423f
commit
ef0d32f0b7
4 changed files with 103 additions and 33 deletions
25
src/main.rs
25
src/main.rs
|
@ -51,6 +51,26 @@ impl Config {
|
|||
)
|
||||
.chain(self.icals.iter().map(|ical| ical.dl.clone()))
|
||||
}
|
||||
|
||||
fn upstreams(&self) -> Vec<CalendarUi> {
|
||||
let Self {
|
||||
campfires,
|
||||
common_ninjas,
|
||||
icals,
|
||||
output: _,
|
||||
} = self;
|
||||
|
||||
let mut upstreams: Vec<_> = campfires
|
||||
.iter()
|
||||
.map(|cfg| &cfg.ui)
|
||||
.cloned()
|
||||
.chain(common_ninjas.iter().map(|cfg| &cfg.ui).cloned())
|
||||
.chain(icals.iter().map(|cfg| &cfg.ui).cloned())
|
||||
.collect();
|
||||
upstreams.sort_by_key(|ui| ui.short_name.clone());
|
||||
|
||||
upstreams
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(clap::Parser)]
|
||||
|
@ -238,7 +258,7 @@ async fn do_everything(cli: &CliAuto) -> Result<()> {
|
|||
|
||||
let data = read_data_from_disk(&config)?;
|
||||
let instances = process_data(&data, &config.output, now)?;
|
||||
output::write_html(&config.output, &instances, now)?;
|
||||
output::write_html(&config.output, &config.upstreams(), &instances, now)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -276,7 +296,8 @@ fn main_debug_output(cli: CliDebugOutput) -> Result<()> {
|
|||
let tz = &config.output.timezone;
|
||||
let now = Utc::now().with_timezone(tz);
|
||||
let instances = process_data(&data, &config.output, now).context("Failed to process data")?;
|
||||
output::write_html(&config.output, &instances, now).context("Failed to output HTML")?;
|
||||
output::write_html(&config.output, &config.upstreams(), &instances, now)
|
||||
.context("Failed to output HTML")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue