hosted-git-info

Crates.iohosted-git-info
lib.rshosted-git-info
version0.1.2
sourcesrc
created_at2021-08-09 08:59:54.149243
updated_at2021-09-15 20:13:20.089532
descriptionProvides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab
homepage
repositoryhttps://github.com/Turbo87/hosted-git-info-rs.git
max_upload_size
id433590
size33,414
Tobias Bieniek (Turbo87)

documentation

README

hosted-git-info

Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab.

This is a Rust port of the original hosted-git-info project on npm.

This will let you identify and transform various git hosts URLs between protocols. It also can tell you what the URL is for the raw path for particular file for direct access without git.

Usage

use hosted_git_info::HostedGitInfo;

fn main() {
    let url = "https://github.com/foo/bar.git#branch";
    let info = HostedGitInfo::from_url(url).unwrap();
    assert_eq!(info.provider, Provider::GitHub);
    assert_eq!(info.user, Some("foo"));
    assert_eq!(info.project, "bar");
    assert_eq!(info.committish, Some("branch"));
}

Related

License

This project is licensed under the ISC license (LICENSE or http://opensource.org/licenses/ISC).

Commit count: 202

cargo fmt