测试git repo是否干净的简单函数
is-git-repo-clean的Python项目详细描述
git repo是否干净
目录
简介
是什么?一个测试git repo是否干净的简单函数。
通过clean我的意思是它有:
- 没有未跟踪的文件
- 无阶段性更改
- 没有未分页的更改
安装它还将公开一个cli命令is-git-repo-clean
为什么要创建它?
<>我想写一个构建脚本,如果Git RePO,它会很早退出。 不干净安装
$ pip install is_git_repo_clean
使用量
编程
importis_git_repo_cleanasyncdefisCleanAsync(pathToGitRepo=None):# async by defaultreturnawaitis_git_repo_clean.check(pathToGitRepo)defisCleanSync(pathToGitRepo=None):# sync availablereturnis_git_repo_clean.checkSync(pathToGitRepo)
cli
$ is-git-repo-clean --help Usage is-git-repo-clean [--dir <path>][--silent] is-git-repo-clean --help is-git-repo-clean --version Options dir: path to the git repo to test. Defaults to `os.getcwd()` silent: disables output help: print this version: prints the version of this tool Returns <exit code>: <output> 0: yes 1: no 2: <invalid arg message> 3: dir is not a git repository 4: unexpected error occurred <error>
api
is_git_repo_clean
导出以下内容
check
异步(dir=os.getcwd())=>;bool
- 返回git repo是否干净的异步函数
checkSync
(dir=os.getcwd())=>;bool
- 返回git repo是否干净的同步函数
version
测试
hub clone olsonpm/py_is-git-repo-clean
cd py_is-git-repo-clean
python runTests.py