import os import nimgit if paramCount() == 0: echo "No git-repo given." quit(QuitFailure) discard git_libgit2_init() try: let gitRepository = openGitRepository(paramStr(1)) let gitRefNames = gitRepository.getGitReferenceNames() for gitRefName in gitRefNames: let gitReference = gitRepository.lookupGitReference(gitRefName) case gitReference.getType(): of referenceDirect: echo gitRefName & ": " & $gitReference.getTarget() of referenceSymbolic: echo gitRefName & " => " & gitReference.getSymbolicTarget() & ": " & $gitReference.getTarget() free(gitReference) free(gitRepository) except: echo "Error:\n", getCurrentExceptionMsg()