[−][src]Crate detect_git_service
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()); }
Enums
Error | Error caused by APIs in detect_git_service crate. |
GitService | Enum variants of Git hosting services which this library supports. |
Functions
detect | Detect Git hosting service from a file path. Path can be both file path and directory path. It returns an error when input was invalid or no service was detected. |
detect_with_git | Almost the same as |