2021-10-10 06:55:50 +02:00
|
|
|
use std::env::args;
|
|
|
|
|
|
|
|
use miette::{IntoDiagnostic, Result};
|
2022-06-15 05:25:05 +02:00
|
|
|
use project_origins::origins;
|
2021-10-10 06:55:50 +02:00
|
|
|
|
2022-06-15 05:25:05 +02:00
|
|
|
// Run with: `cargo run --example find-origins [PATH]`
|
2021-10-10 06:55:50 +02:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<()> {
|
|
|
|
tracing_subscriber::fmt::init();
|
|
|
|
|
2022-06-15 05:25:05 +02:00
|
|
|
let first_arg = args().nth(1).unwrap_or_else(|| ".".to_string());
|
2023-01-06 14:53:49 +01:00
|
|
|
let path = tokio::fs::canonicalize(first_arg).await.into_diagnostic()?;
|
2022-06-15 05:25:05 +02:00
|
|
|
|
2021-10-10 06:55:50 +02:00
|
|
|
for origin in origins(&path).await {
|
|
|
|
println!("{}", origin.display());
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|