1 个不稳定版本
0.1.0 | 2020年4月25日 |
---|
#59 in #时间跟踪
24KB
458 代码行
ttrack
时间跟踪和报告命令行工具。
功能
- 开始时间跟踪
- 停止时间跟踪
- 编辑跟踪活动
- 删除跟踪活动
- 标签
- 报告
安装
cargo install ttrack
使用方法
显示帮助信息
$ ttrack help
$ ttrack <command> --help
示例用法
$ ttrack start "Setup ubuntu server" -t client:BigCo -t "project:BigCo Homepage"
edfb7ef7 2020-04-25T15:00:06+08:00 - ......................... 00:00:00 Setup ubuntu server............................... [client:BigCo] [project:BigCo Homepage]
$ ttrack stop
edfb7ef7 2020-04-25T15:00:06+08:00 - 2020-04-25T15:01:14+08:00 00:01:08 Setup ubuntu server............................... [client:BigCo] [project:BigCo Homepage]
$ ttrack start "Setup CI pipeline" -t client:BigCo -t "project:BigCo Homepage"
e09c79d4 2020-04-25T15:03:30+08:00 - ......................... 00:00:00 Setup CI pipeline................................. [client:BigCo] [project:BigCo Homepage]
$ ttrack history
e09c79d4 2020-04-25T15:03:30+08:00 - ......................... 00:00:33 Setup CI pipeline................................. [client:BigCo] [project:BigCo Homepage]
edfb7ef7 2020-04-25T15:00:06+08:00 - 2020-04-25T15:01:14+08:00 00:01:08 Setup ubuntu server............................... [client:BigCo] [project:BigCo Homepage]
$ ttrack edit e09c79d4 -n "Setup CI/CD pipeline" -d client:BigCo -a project:ttrack -a client:myself
e09c79d4 2020-04-25T15:03:30+08:00 - ......................... 00:00:33 Setup CI/CD pipeline.............................. [client:myself] [project:BigCo Homepage] [project:ttrack]
输出格式
<ID> <START_TIME> - <END_TIME> <DURATION> <ACTIVITY_NAME> <TAGS>
该工具还可以生成包含按标签分解花费时间的报告。
$ ttrack report
00:33:42 project:ttrack
00:32:28 client:personal
00:01:19 untagged
00:00:14 client:Big Co
命令
开始跟踪
$ ttrack start --help
Start tracking an activity
USAGE:
ttrack start [OPTIONS] <ACTIVITY_NAME>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-t, --tag <tags>... Activity tags. You can supply multiple values for this flag
ARGS:
<ACTIVITY_NAME> Activity name
停止跟踪
$ ttrack stop --help
Finish tracking current activity
USAGE:
ttrack stop
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
编辑跟踪活动
$ ttrack edit --help
Edit tracked activity
USAGE:
ttrack edit [OPTIONS] <ACTIVITY_ID>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-e, --end-time <end-time> Edit the activity end time
-n, --name <name> Edit the activity name
-s, --start-time <start-time> Edit the activity start time
-a, --tags-to-add <tags-to-add>... Tags to be added. You can supply multiple values for this tag
-d, --tags-to-del <tags-to-del>... Tags to be removed. You can supply multiple values for this tag
ARGS:
<ACTIVITY_ID> ID of the activity to be changed. e.g. `6aed4521`. You can get IDs from running `history`
command
显示历史记录
$ ttrack history --help
Show the list of tracked activities, starting from recent ones
USAGE:
ttrack history [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-e, --end-time <end-time> [default: 3000-01-01T00:00:00+00:00]
-p, --page <page> [default: 0]
-n, --page-size <page-size> [default: 20]
-s, --start-time <start-time> [default: 1970-01-01T00:00:00+00:00]
报告
$ ttrack report --help
Show report of total activities duration broken down by tag
USAGE:
ttrack report [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-e, --end-time <end-time> [default: 3000-01-01T00:00:00+00:00]
-s, --start-time <start-time> [default: 1970-01-01T00:00:00+00:00]
导出数据
应用程序数据存储在这些文件夹中
平台 | 值 | 示例 |
---|---|---|
Linux | $XDG_DATA_HOME 或 $HOME /.local/share/ttrack/ttrack.db |
/home/alice/.local/share/ttrack/ttrack.db |
macOS | $HOME /Library/Application\ Support/ttrack/ttrack.db |
/Users/Alice/Library/Application\ Support/ttrack/ttrack.db |
Windows | {FOLDERID_LocalAppData} \ttrack\ttrack.db |
C:\Users\Alice\AppData\Local\ttrack\ttrack.db |
ttrack.db
是一个 SQLite 文件。
依赖项
~26MB
~487K SLoC