ctucx.git: nimgit

[nimlang] nim-wrapper for libgit2

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 import os
import nimgit

if paramCount() == 0:
    echo "No git-repo given."
    quit(QuitFailure)

discard git_libgit2_init()

try:
    let gitRepository = openGitRepository(paramStr(1))

    for branch in gitRepository.branches(branchAll):
        if branch.isLocalBranch():
            echo "local: " & branch.getBranchName()

        if branch.isRemoteBranch():
            echo "remote: " & branch.getBranchName()

        free(branch)

    free(gitRepository)
except:
    echo "Error:\n", getCurrentExceptionMsg()