GitKit (🐱)

GitKit 是一个围绕 git 命令行界面的 Swift 封装。

用法

一些基本示例

import GitKit

try Git().run(.cmd(.config, "--global user.name"))

let git = Git(path: "~/example/")

try git.run(.cmd(.initialize))
try git.run(.cmd(.status))
try git.run(.cmd(.branch, "-a"))
try git.run(.cmd(.pull))

try git.run(.clone(url: "https://gitlab.com/binarybirds/shell-kit.git"))
try git.run(.commit(message: "some nasty bug fixed"))
try git.run(.log(1))
try git.run(.tag("1.0.0"))
try git.run(.pull(remote: "origin", branch: "master"))
try git.run(.push(remote: "origin", branch: "master"))
try git.run(.create(branch: "dev"))
try git.run(.checkout(branch: "master"))
try git.run(.merge(branch: "dev"))

try git.run(.raw("log -2"))
try git.run(.raw("rebase -i <hash>"))

安装

像往常一样使用 Swift Package Manager 即可

.package(url: "https://github.com/binarybirds/git-kit", from: "1.0.0"),

不要忘记将 "GitKit" 作为依赖项添加到你的目标中

.product(name: "GitKit", package: "git-kit"),

就这样。

许可证

WTFPL - 爱怎么用就怎么用。