13个版本
| 0.5.0 | 2022年1月13日 |
|---|---|
| 0.4.3 | 2020年10月23日 |
| 0.3.0 | 2020年10月22日 |
| 0.2.0 | 2020年10月22日 |
| 0.1.5 | 2020年10月22日 |
在 日期和时间 类别中排名第385
30KB
144 行
timeago-cli
一个简单的CLI工具,用于将RFC2822转换为简短的人性化字符串。适用于提示信息
用法
$ timeago 'Wed, 21 Oct 2020 00:07:08 -0700'
与 git log 结合使用,以获取上次提交的时间
$ timeago "$(git log -1 --format=%cD)"
12h
安装
cargo install timeago-cli
选项
使用 --long 获取更长的字符串
$ timeago "$(git log -1 --format=%cD)" --long
12 hours
或者使用 --precise 获取精确的时间ago字符串
$ timeago "$(git log -1 --format=%cD)" --precise
12 hours 30 minutes and 19 seconds
使用 --seperator 自定义分隔符(默认 )
$ timeago "$(git log -1 --format=%cD)" --precise --separator '|'
12h|31m|43s
依赖项
~4MB
~69K SLoC