Initial commit
This commit is contained in:
commit
1ac069bf28
3 changed files with 36 additions and 0 deletions
15
git2/git2.c.v
Normal file
15
git2/git2.c.v
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
module git2
|
||||||
|
|
||||||
|
#flag -lgit2
|
||||||
|
|
||||||
|
#include "git2.h"
|
||||||
|
|
||||||
|
pub struct C.git_repository {}
|
||||||
|
|
||||||
|
pub struct C.git_clone_options {}
|
||||||
|
|
||||||
|
fn C.git_libgit2_init()
|
||||||
|
|
||||||
|
fn C.git_libgit2_shutdown()
|
||||||
|
|
||||||
|
fn C.git_clone(&&C.git_repository, &char, &char, &C.git_clone_options) int
|
||||||
16
git2/git2.v
Normal file
16
git2/git2.v
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
module git2
|
||||||
|
|
||||||
|
fn init() {
|
||||||
|
C.git_libgit2_init()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn clone(url string, path string) !&C.git_repository {
|
||||||
|
out := &C.git_repository{}
|
||||||
|
res := C.git_clone(&out, url.str, path.str, 0)
|
||||||
|
|
||||||
|
if res != 0 {
|
||||||
|
return error('Exit code $res')
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
5
main.v
Normal file
5
main.v
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import git2
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
git2.clone("https://aur.archlinux.org/vlang.git", "test")!
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue