use std::io::IsTerminal;
use std::process::ExitCode;
fn main() -> ExitCode {
if let Err(error) = color_eyre::install() {
eprintln!("wt: failed to install error reporter: {error}");
return ExitCode::FAILURE;
}
let filter = tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn"));
tracing_subscriber::fmt()
.with_env_filter(filter)
.with_writer(std::io::stderr)
.init();
let out = wt::Stream::new(Box::new(std::io::stdout()), std::io::stdout().is_terminal());
let err = wt::Stream::new(Box::new(std::io::stderr()), std::io::stderr().is_terminal());
let cwd = std::env::current_dir().unwrap_or_default();
let git = std::sync::Arc::new(wt::git::RealGit);
let gh = std::sync::Arc::new(wt::gh::RealGh);
let agent = std::sync::Arc::new(wt::agent::RealAgent);
let input = Box::new(wt::cx::StdinInput);
let mut cx = wt::Cx::new(out, err, wt::Env::from_real(), cwd, git, gh, agent, input);
let args = std::env::args().skip(1).collect();
ExitCode::from(wt::run(args, &mut cx))
}