NYI macro, cleanup transition function
This commit is contained in:
parent
60956b6303
commit
92d87193a8
|
@ -4,6 +4,7 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
stdext = "0.3.3"
|
||||
pandoc = "0.8"
|
||||
chrono = "0.4.38"
|
||||
regex = "1.10.5"
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
|
||||
use crate::is_dry_run;
|
||||
use crate::key_value::KeyValueStore as KV;
|
||||
use crate::NYI;
|
||||
use std::error::Error;
|
||||
use std::io::{self, Write};
|
||||
|
||||
|
@ -217,6 +218,7 @@ impl<'a> CfgField<'a> {
|
|||
/// Ensure all fields with known default values exist.
|
||||
pub fn populate_defaults(spec: &CfgSpec, config: &KV) {
|
||||
for group in spec.groups {
|
||||
NYI!("asdf");
|
||||
for field in group.fields {
|
||||
match field {
|
||||
CfgField::Silent { default, .. } => {
|
||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -16,3 +16,21 @@ use std::env;
|
|||
pub fn is_dry_run() -> bool {
|
||||
env::var("DRY_RUN").map(|v| !v.is_empty()).unwrap_or(false)
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! NYI {
|
||||
($msg:expr) => {{
|
||||
static ONCE: std::sync::Once = std::sync::Once::new();
|
||||
let location = stdext::debug_name!();
|
||||
ONCE.call_once(|| {
|
||||
eprintln!("{}: NYI -- {}", location, $msg);
|
||||
});
|
||||
}};
|
||||
() => {{
|
||||
static ONCE: std::sync::Once = std::sync::Once::new();
|
||||
let location = stdext::debug_name!();
|
||||
ONCE.call_once(|| {
|
||||
eprintln!("{}: NYI!", location);
|
||||
});
|
||||
}};
|
||||
}
|
||||
|
|
30
src/main.rs
30
src/main.rs
|
@ -52,6 +52,7 @@ use cccron_lib::email::{self, Email, SimpleEmail};
|
|||
use cccron_lib::hedgedoc::{self, HedgeDoc};
|
||||
use cccron_lib::is_dry_run;
|
||||
use cccron_lib::mediawiki::{self, Mediawiki};
|
||||
use cccron_lib::NYI;
|
||||
|
||||
const FALLBACK_TEMPLATE: &str = variables_and_settings::FALLBACK_TEMPLATE;
|
||||
|
||||
|
@ -737,14 +738,20 @@ fn do_reminder(
|
|||
hedgedoc.format_url(¤t_pad_id)
|
||||
)
|
||||
} else {
|
||||
"Da es immer noch keine Themen gibt fällt das Plenum aus.\n\n".to_string()
|
||||
+ "(Natürlich könnt ihr im Bedarfsfall immer noch kurzfristig ein Treffen einberufen, aber bitte "
|
||||
+ "kündigt das so früh wie möglich an, damit Leute sich darauf einstellen können.)"
|
||||
// TODO generate + add link for next pad
|
||||
NYI!("generate link / pad for next plenum & include in this email");
|
||||
"Da es immer noch keine Themen gibt fällt das Plenum aus.\n\n\
|
||||
(Natürlich könnt ihr im Bedarfsfall immer noch kurzfristig ein Treffen einberufen, aber bitte \
|
||||
kündigt das so früh wie möglich an, damit Leute sich darauf einstellen können.)"
|
||||
.to_string()
|
||||
};
|
||||
// send it
|
||||
let _message_id = send_email(&subject, &body, &email, &config)?;
|
||||
// on success, update state (ignore write errors, they'll be checked later)
|
||||
if n_topics == 0 {
|
||||
NYI!(
|
||||
"do we skip ahead to ProgramState::Logged here or do we later add a note to the wiki?"
|
||||
);
|
||||
}
|
||||
config.set("state-name", &ProgramState::Reminded.to_string()).ok();
|
||||
config.set("state-toc", &toc).ok();
|
||||
Ok(())
|
||||
|
@ -764,14 +771,17 @@ fn do_protocol(
|
|||
|
||||
/// General cleanup function. Call as `(999, today, …)` for a complete reset
|
||||
/// based on today as the base date.
|
||||
#[allow(unused_variables)]
|
||||
#[allow(unused_must_use)]
|
||||
fn do_cleanup(
|
||||
ttp: i64, plenum_day: &NaiveDate, config: &KV, hedgedoc: &HedgeDoc, email: &SimpleEmail,
|
||||
wiki: &Mediawiki,
|
||||
_ttp: i64, _plenum_day: &NaiveDate, config: &KV, _hedgedoc: &HedgeDoc, _email: &SimpleEmail,
|
||||
_wiki: &Mediawiki,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
// TODO: reset any state vars (e.g. summary)
|
||||
// TODO: set state back to normal
|
||||
todo!()
|
||||
config.delete("state-toc");
|
||||
config.delete("email-last-message-id");
|
||||
NYI!("rotate pad links");
|
||||
NYI!("double-check state for leftovers");
|
||||
config.set("state-name", &ProgramState::Normal.to_string());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/* ***** state machine ***** */
|
||||
|
|
Loading…
Reference in a new issue