4 releases
0.2.1 | Mar 27, 2019 |
---|---|
0.2.0 | Feb 25, 2019 |
0.1.1 | Dec 11, 2018 |
0.1.0 | Dec 8, 2018 |
#9 in #libgit2
Used in nip
50KB
1K
SLoC
nip_core
Welcome to nip_core
, the nip backing
library! Go here for documentation.
lib.rs
:
nip_core
is a library that lets you interact with nip
repositories programmatically.
extern crate failure;
extern crate git2;
extern crate ipfs_api;
extern crate nip_core;
use failure::Error;
use git2::Repository;
use ipfs_api::IpfsClient;
use nip_core::{NIPIndex, NIPRemote};
// Open the local repository
let mut repo = Repository::open_from_env()?;
// Get a handle for IPFS API
let mut ipfs = IpfsClient::default();
// Instantiate a brand new nip index
let mut idx = NIPIndex::from_nip_remote(&NIPRemote::NewIPFS, &mut ipfs)?;
// Upload the full object tree behind a specified local ref to IPFS
idx.push_ref_from_str("refs/heads/master", "refs/heads/master", false, &mut repo, &mut ipfs)?;
// Also upload the brand new index itself
let nip_remote: NIPRemote = idx.ipfs_add(&mut ipfs, None)?;
println!("Success! refs/heads/master uploaded to remote {}", nip_remote.to_string());
Dependencies
~23–35MB
~619K SLoC