1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// src/git/mod.rs
//! Handles cloning, caching, and updating of git repositories.
//!
//! This module provides functionality to:
//! - Clone remote git repositories into a local cache using `git2`.
//! - Update cached repositories on subsequent runs.
//! - Parse GitHub folder URLs and download their contents via the GitHub API using `reqwest`.
//! - Provide authentication callbacks for SSH-based cloning.
// Declare the sub-modules.
// Re-export the public-facing API.
/// Downloads a directory's contents from the GitHub API.
///
/// # Examples
///
/// ```no_run
/// use dircat::git::{parse_github_folder_url, download_directory_via_api};
///
/// # fn main() -> anyhow::Result<()> {
/// let url = "https://github.com/rust-lang/cargo/tree/master/src/cargo";
/// let parsed_url = parse_github_folder_url(url).unwrap();
/// let temp_dir_path = download_directory_via_api(&parsed_url, &None)?;
/// println!("Downloaded to: {}", temp_dir_path.display());
/// // Remember to clean up the temp directory if needed.
/// # Ok(())
/// # }
/// ```
pub use download_directory_via_api;
/// Clones or updates a git repository into a local cache directory.
///
/// # Examples
///
/// ```no_run
/// use dircat::git::get_repo;
/// use std::path::Path;
/// # fn main() -> anyhow::Result<()> {
/// let repo_path = get_repo("https://github.com/rust-lang/cargo.git", &None, None, Path::new("/tmp/dircat-cache"), None)?;
/// println!("Repo is at: {}", repo_path.display());
/// # Ok(())
/// # }
/// ```
pub use ;
/// Functions and types for parsing git and GitHub URLs.
pub use update_repo;
pub use ;