watchexec/lib/examples/project-origins.rs
2021-10-10 17:56:49 +13:00

18 lines
425 B
Rust

use std::env::args;
use miette::{IntoDiagnostic, Result};
use watchexec::project::origins;
// Run with: `cargo run --example project-origins [PATH]`
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let path =
dunce::canonicalize(args().nth(1).unwrap_or_else(|| ".".to_string())).into_diagnostic()?;
for origin in origins(&path).await {
println!("{}", origin.display());
}
Ok(())
}