detect_git_service

Crates.iodetect_git_service
lib.rsdetect_git_service
version1.0.0
sourcesrc
created_at2019-02-06 10:13:08.057738
updated_at2019-02-06 10:13:08.057738
descriptionDetect Git hosting service from file path
homepage
repositoryhttps://github.com/rhysd/detect_git_service
max_upload_size
id113052
size18,887
Linda_pp (rhysd)

documentation

README

detect_git_service crate

crates.io documentation CI on Linux and macOS CI on Windows

detect_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.

Installation

Add detect_git_service to your crate's dependencies.

"detect_git_service" = "1"

License

Distributed under the MIT License.

Commit count: 14

cargo fmt