diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-03-06 13:09:11 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-03-06 13:09:11 +0100 |
commit | db7d22966b89c62e236eae559fca1d4e840897e3 (patch) | |
tree | 7106b499d98e6e54d5562393b5e42ffe18402251 /src | |
parent | abb8a9b2b9867766513cdb6050218bc09b2da4b3 (diff) | |
download | ezau-db7d22966b89c62e236eae559fca1d4e840897e3.tar.gz ezau-db7d22966b89c62e236eae559fca1d4e840897e3.tar.bz2 ezau-db7d22966b89c62e236eae559fca1d4e840897e3.zip |
warn when logs are unnecessarily being uploaded
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 14 |
1 files 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<String> { 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. \ |