Skip to content

bachp/git-credential-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Credential

Build Status Crate API

A Rust library that provides types that help to implement git-credential helpers.

Usage

Add this to your Cargo.toml:

[dependencies]
git-credential = "*"

This crates provides types that are able to parse input and produce output in the format described in git-credential[1] .

The following shows an example on how create a GitCredential struct from an input, modify it and write it back to an output:

use git_credential::GitCredential;

let input = "username=me\npassword=%sec&ret!\n\n".as_bytes();
let mut output: Vec<u8> = Vec::new();

let mut g = GitCredential::from_reader(input).unwrap();

assert_eq!(g.username.unwrap(), "me");
assert_eq!(g.password.unwrap(), "%sec&ret!");

g.username = Some("you".into());
g.password = Some("easy".into());

g.to_writer(&mut output).unwrap();

assert_eq!("username=you\npassword=easy\n\n", String::from_utf8(output).unwrap())

See the API documentation for more details.

License

Rand is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT, and COPYRIGHT for details.

About

Crate that provides types that help to implement git-credential helpers

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages