Small Rust crate to detect Git service from file path
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.appveyor.yml
.gitignore
.travis.yml
Cargo.toml
LICENSE
README.md

README.md

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.

[dependencies]
detect_git_service = "1"

License

Distributed under the MIT License.