#git-repository #git #utility #command-line-tool #cli

app 吉库

通过吉库估算在Git仓库上工作的时间

2个版本

0.1.1 2021年4月25日
0.1.0 2021年4月25日

286#git-repository

每月 34 次下载

MIT 许可证

27KB
539 代码行

吉库(时给)

估算在Git仓库上花费的时间的工具。

它是从Node.js编写的git-hours的直接移植,因为代码已经多年未更新且无法构建。

请注意,提供的信息仅为粗略估计。

安装

cargo install jikyuu

示例

git clone https://github.com/twbs/bootstrap
cd bootstrap
jikyuu
+----------------+-------------------------+---------+-----------------+
| Author         | Email                   | Commits | Estimated Hours |
|                |                         |         |                 |
| Mark Otto      | markdotto@gmail.com     | 2902    | 1808.9833       |
| Mark Otto      | otto@github.com         | 2516    | 1709.4          |
| XhmikosR       | xhmikosr@gmail.com      | 1431    | 1612.4667       |
| Chris Rebert   | code@rebertia.com       | 945     | 1019.3          |
| Jacob Thornton | jacobthornton@gmail.com | 826     | 740.35          |
| Mark Otto      | markotto@twitter.com    | 858     | 663.7167        |
| <...>          |                         |         |                 |
|                |                         |         |                 |
| Total          |                         | 16639   | 15041.153       |
+----------------+-------------------------+---------+-----------------+

您可以使用 --email (-e) 选项将提交日志中使用了多个电子邮件的作者关联起来。

jikyuu -e [email protected][email protected] \
       -e [email protected][email protected] \
       -e [email protected][email protected] \
       -e [email protected][email protected]

+-----------------+---------------------------+---------+-----------------+
| Author          | Email                     | Commits | Estimated Hours |
|                 |                           |         |                 |
| Mark Otto       | markdotto@gmail.com       | 6880    | 4662.817        |
| XhmikosR        | xhmikosr@gmail.com        | 1431    | 1612.4667       |
| Chris Rebert    | code@rebertia.com         | 945     | 1019.3          |
| Jacob Thornton  | jacobthornton@gmail.com   | 826     | 740.35          |
| Martijn Cuppens | martijn.cuppens@gmail.com | 361     | 508.5           |
| <...>           |                           |         |                 |
+-----------------+---------------------------+---------+-----------------+

使用 --format json (-f) 将数据输出为JSON数组。

[
  {
    "email": "[email protected]",
    "author_name": "Mark Otto",
    "hours": 4662.817,
    "commit_count": 6880
  },
  {
    "email": "[email protected]",
    "author_name": "XhmikosR",
    "hours": 1612.4667,
    "commit_count": 1431
  },

  // ...

  {
    "email": null,
    "author_name": "Total",
    "hours": 14826.803,
    "commit_count": 16639
  }
]

算法

请参阅 git-hours README 中的 工作原理 部分。

用法

运行以下命令以估算提供的Git仓库所花费的时间。

jikyuu /path/to/git/repo/

路径必须指向Git仓库的根目录,而不是其中的任何子目录。

扩展用法

USAGE:
    jikyuu [FLAGS] [OPTIONS] <REPO_PATH>

FLAGS:
    -h, --help              Prints help information
    -m, --merge-requests    Include merge requests into calculation
    -V, --version           Prints version information

OPTIONS:
    -b, --branch <branch>                                                Analyze only data on the specified branch
    -t, --branch-type <local|remote>
            Type of branch that `branch` refers to. `local` means refs/heads/, `remote` means refs/remotes/.

    -e, --email <OTHER_EMAIL=MAIN_EMAIL>...
            Associate all commits that have a secondary email with a primary email

    -a, --first-commit-add <MINUTES>
            How many minutes first commit of session should add to total [default: 120]

    -f, --format <format>
             [default: stdout]  [possible values: Stdout, Json]

    -d, --max-commit-diff <MINUTES>
            Maximum difference in minutes between commits counted to one session [default: 120]

    -s, --since <always|today|yesterday|thisweek|lastweek|YYYY-mm-dd>
            Analyze data since certain date [default: always]

    -u, --until <always|today|yesterday|thisweek|lastweek|YYYY-mm-dd>
            Analyze data until certain date [default: always]


ARGS:
    <REPO_PATH>    Root path of the Git repository to analyze.

许可证

MIT。

依赖关系

~17MB
~368K SLoC