| 3 | use up2code::{diff, listings}; |
| 4 | |
| 5 | fn main() -> anyhow::Result<()> { |
| 6 | let paths: Vec<String> = env::args().skip(1).collect(); |
| 7 | if paths.is_empty() { |
| 8 | eprintln!("Usage: up2code [PATH, ...]"); |
| 9 | return Ok(()); |
| 10 | } |
| 11 | for path in paths { |
| 12 | for listing in listings(&path)? { |
| 13 | let listing = listing.check()?; |
| 14 | if let Some(diff) = diff(&listing.local, &listing.remote) { |
| 15 | println!("{path}: {} - {}", listing.title, listing.url); |
| 16 | println!("{diff}"); |
| 17 | } |
| 18 | // Sleep to avoid hitting GitHub API rate limit |
| 19 | thread::sleep(Duration::from_secs(1)); |
| 20 | } |
| 21 | } |
| 22 | Ok(()) |
| 23 | } |