devops_cli/
lib.rs

1#![deny(clippy::unwrap_used)]
2
3use crate::config::ConfigArgs;
4
5pub mod aws;
6pub mod config;
7pub mod tunnelblick;
8
9pub fn init(name: &str, config_args: &ConfigArgs) -> anyhow::Result<()> {
10    config::load_env_files(name, config_args)?;
11
12    let env_name = format!("{}_LOG", name.replace('-', "_").to_uppercase());
13    let filter = config::get_opt(&env_name)?.unwrap_or_else(|| "warn".to_string());
14
15    tracing_subscriber::fmt()
16        .with_env_filter(filter)
17        .with_writer(std::io::stderr)
18        .init();
19
20    Ok(())
21}
22
23pub const XKCD_EXPECT_MSG: &str = "\n\n==============================================================================\nIf you're seeing this, the code is in what I thought was an unreachable state.\nI could give you advice for what to do. But honestly, why should you trust me?\nI clearly screwed this up. I'm writing a message that should never appear, yet\nI know it will probably appear someday.\n\nOn a deep level, I know I'm not up to this task. I'm so sorry.\n\n ~ https://xkcd.com/2200/\n==============================================================================\n\n";