#date #version #major #user #recent #how #generate

app date-version

基于主版本和日期生成版本。因为通常用户只关心版本的新旧程度。

2 个版本

0.1.1 2021年5月20日
0.1.0 2021年5月20日

#2#major

MIT/Apache

10KB
137

date-version

安装

cargo install date-version

示例

指向一个报告来自 4.1.0-2-g0ebd049 的 git 仓库的 git describe.

date-version path/to/repo --date

返回:4.7707.0,或 major.days.0。天数是自 2000.01.01 以来经过的天数。

date-version path/to/repo --date-split

返回:4.30.2,或 major.days1.days2。天数分为两个 u8,以覆盖次要和修补程序。

date-version path/to/repo --date --drop-patch --revisions

返回:4.7707.2,或 major.days.commitsSinceTag。修补程序被删除,添加了自上次标签以来的提交。

参考

Date Version 0.1.0
Conor Patrick <conor@solokeys.com>
Generate a version string that is based on the latest tag in a git repo and it's creation date.  Because usually users
just want to know how recent a version is.

USAGE:
    date-version [FLAGS] [PATH]

FLAGS:
        --date                    Output version as major.days.0 (u16.u16.0), where major is from the last tag in the
                                  git repo, and days is number of days since 2000.01.01.
        --date-split              Output version as major.days1.days2 (u16.u8.u8), where major is from the last tag in
                                  the git repo, and ((days1 << 8) | days2) is number of days since 2000.01.01.
        --drop-major              Drop the major from the output.
        --drop-minor              Drop the minor from the output.
        --drop-patch              Drop the patch from the output.
        --enforce-u8              Fail if any version component does not fit in a u8.
    -h, --help                    Prints help information. Use --help for more details.
        --revisions               add .revisions (.u16) to the end of the output, where revisions is number of commits
                                  since last tag.
        --revisions-prerelease    add -revisions (-u16) to the end of the output, where revisions is number of commits
                                  since last tag.
    -V, --version                 Prints version information

ARGS:
    <PATH>    Path to git repo.

依赖

~12MB
~279K SLoC