Crates.io | detect_git_service |
lib.rs | detect_git_service |
version | 1.0.0 |
source | src |
created_at | 2019-02-06 10:13:08.057738 |
updated_at | 2019-02-06 10:13:08.057738 |
description | Detect Git hosting service from file path |
homepage | |
repository | https://github.com/rhysd/detect_git_service |
max_upload_size | |
id | 113052 |
size | 18,887 |
detect_git_service
cratedetect_git_service
is a small crate to detect the Git hosting service from a path.
The service is detected based on a URL of remote repository of the path.
extern crate detect_git_service;
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());
}
Please read the documentation for more details.
Add detect_git_service
to your crate's dependencies.
"detect_git_service" = "1"
Distributed under the MIT License.