10 个稳定版本

1.3.2 2021年9月1日
1.3.0 2021年8月31日
1.0.3 2021年7月20日

#1787 in 开发工具

31 每月下载次数

自定义许可证

86KB
2K SLoC

Confit

确保您的作品在 git 中得到妥善保存!

Confit

例如

 confit
               all files tracked: true
             no unstaged changes: false
           no uncommited changes: true
     commit tracked by local ref: true
            branch tracks remote: true
  all commits merged from remote: true
    all commits pushed to remote: true
        current commit is tagged: false
                   tag is pushed: false
 echo $?
18

错误代码是通过各种“家族”的提交检查的按位或运算得出的。

其他功能的简要总结可以在命令行帮助文本中找到

Confit 1.1.1
Judson <nyarly@gmail.com>

Generates reports about the state of version control for the current workspace.
Git status is collected, and then a series of checks are run on it to establish
that the contents of the workspace are stored, synchronized and recoverable.
The results of these checks are then formatted into a report via a selectable
template.

These reports help confirm that you've properly committed, pushed and tagged
your work. This can help smooth collaboration with other humans, as well as
reduce the problem surface when debugging automated tools, like continuous
integration systems.

USAGE:
    confit [FLAGS] [OPTIONS]

FLAGS:
        --debug      outputs debug data
    -h, --help       Prints help information
    -q, --quiet      suppress normal state summary; scripts can rely on the status code
    -V, --version    Prints version information

OPTIONS:
    -c, --checks <checks>...     [possible values: commit, detached,
        git_prompt, local, merge, push, push_tag, stage, tag, track_files, track_remote]
    -f, --format <format>       choose a format for output [default: summary]
        [possible values: summary, statusline, debug]

EXAMPLES

> confit --checks git_prompt --format statusline
main|+3?2

In a fish_prompt.fish:

  set -l statusline (confit -c git_prompt -f statusline)
  test $status -lt 128; and echo -n ""$statusline

Two of the options to --checks are special: they select groups of checks:
'git_prompt' (suitable for a command line prompt function) and 'local', which
includes only those checks that don't require data collection from the git
remote, which can be useful e.g. to avoid authenticating, or network delays.
The checks performed on the workspace determine what data needs to be
collected. You can select which checks to perform with the --checks flag.

To aid machine use of this tool, its exit status is significant.

Anything over 127 indicates errors running git (for instance: not in a git
workspace), or rendering templates.

Statuses less than or equal to 127 are the bitwise OR of the "status group" of
any failing checks. Those groups are:

   2: Local files uncommitted (unknown, only staged, etc.)
   4: Commits unrecorded to the remote
   8: Remote commits not pulled
  16: Commit not tagged, or tag not pushed

背景

Confit 的设计旨在解决一个简单但非常普遍的问题:在 Git 中,一个问题变得相对复杂:是否将作品妥善且完整地提交到版本控制。这是一个足够严重的问题,以至于人们在火灾等紧急情况下离开建筑物之前会开玩笑说要将作品推送到远程。更严重的是,可重复的持续部署依赖于能够恢复由已部署的工件表示的特定代码状态。

随着时间的推移,已经产生了许多临时解决方案来满足这些需求,这些解决方案各不相同,解析 Git 输出的不同方面,以打印命令行提示、管理发布、准备代码生成等等。

据我所知,没有单个工具可以回答“这个代码是否完整且正确保存?”因此,Confit 应运而生。

详细信息

Confit 运行 git 来确定当前工作空间的状态。它使用 Nom 解析器快速解释结果,然后根据它使用的九项标准生成一个关于“保存良好的”工作空间的报告。

并非所有用例都需要所有标准;其中两个,特别是需要网络访问来检查。因此,confit 有一个标志来选择要运行的检查,以及两个“组”标签:local(包含不需要网络访问的检查)和 git_prompt(也排除了与标签相关的检查)。

此外,confit 有标志来选择格式;最值得注意的是,有 summary(默认格式)和 statusline,后者适用于在 shell 提示符中使用。

许可证

本软件包遵循Indie Code Catalog 免费许可证,商业用途可购买。

依赖项

约11–21MB
约288K SLoC