From db7d22966b89c62e236eae559fca1d4e840897e3 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 6 Mar 2021 13:09:11 +0100 Subject: warn when logs are unnecessarily being uploaded --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 55bd637..cc1bb78 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,7 +78,7 @@ fn main() { fn inner_main(opts: &Opts) -> Result<()> { let config = config::load(&opts.config).context("Could not load configuration")?; - sanity_check(&config)?; + sanity_check(&config, opts)?; match &opts.subcmd { SubCommand::Watch(w) => watch(w, &config)?, @@ -250,7 +250,17 @@ fn upload_log(file: &Path) -> Result { Ok(resp.permalink) } -fn sanity_check(config: &Config) -> Result<()> { +fn sanity_check(config: &Config, opts: &Opts) -> Result<()> { + if matches!(opts.subcmd, SubCommand::Watch(_)) + && config.discord.is_none() + && config.matrix.is_none() + && config.upload + { + warn!( + "You are uploading logs but not posting them anywhere. \ + Consider setting `upload = false` in your settings." + ); + } if config.discord.is_some() && !cfg!(feature = "im-discord") { bail!( "Discord is configured but ezau was built without Discord support. \ -- cgit v1.2.3