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
//! Detect Git hosting service from file path //! //! This library provides APIs to detect Git hosting service used for given //! file path. Service is detected based on a URL of remote repository of the //! path. //! //! ``` //! use std::path::Path; //! use detect_git_service::GitService; //! //! let path = Path::new("."); //! let service = detect_git_service::detect(&path).unwrap(); //! //! assert_eq!(service.user(), "rhysd"); //! assert_eq!(service.repo(), "detect_git_service"); //! assert!(service.branch().is_some()); //! //! if let GitService::GitHub{user, repo, branch} = service { //! assert_eq!(user, "rhysd"); //! assert_eq!(repo, "detect_git_service"); //! assert!(branch.is_some()); //! } //! ``` #![deny(missing_docs)] extern crate diff_enum; extern crate url; mod error; mod git; mod service; pub use crate::error::Error; pub use crate::service::{detect, detect_with_git, GitService};