opp 0.0.7

🚧 OpenPlugin Protocol (WIP, nothing usable for now).
Documentation
use opp::ast::AnyRes;
use tracing_subscriber::fmt::{format::FmtSpan, time::ChronoLocal};

#[cfg(debug_assertions)]
fn init_tracing() {
    tracing_subscriber::fmt()
        .with_timer(ChronoLocal::new("%m-%d %H:%M:%S".into()))
        .with_max_level(tracing::Level::DEBUG)
        .with_span_events(FmtSpan::FULL)
        .with_thread_names(true)
        .init();
}

#[cfg(not(debug_assertions))]
fn init_tracing() {
    tracing_subscriber::fmt()
        .with_timer(ChronoLocal::new("%m-%d %H:%M:%S".into()))
        .with_span_events(FmtSpan::FULL)
        .with_thread_names(true)
        .init();
}

// See: https://github.com/tokio-rs/tracing/issues/3068
fn init_tracing_with_ansi() {
    #[cfg(windows)]
    nu_ansi_term::enable_ansi_support().ok();
    init_tracing();
}

#[tokio::main]
async fn main() -> AnyRes {
    init_tracing_with_ansi();
    tracing::info!("Hello, world!");
    Ok(())
}