#时间跟踪 #时间 #实用工具 #导出 #ical #摘要 #结束

app timetrack_jr

简单的CLI时间跟踪工具

1 个稳定版本

1.0.0 2022年11月12日

#1303编码

自定义许可

54KB
1K SLoC

Timetrack Jr.

一个小的CLI实用工具,用于跟踪完成不同活动所需的时间(在工作、顾问或任何地方!)。

Timetrack Jr.将不同活动的开始和结束时间记录到本地的sqlite数据库中,并可以导出这些时间记录的摘要为csv、json、文本摘要或.ical文件(您可以将其导入您最喜欢的日历工具)。

1. 功能

  1. 记录不同类别活动的开始和结束时间
  2. 生成可能有用的已记录时间导出
  3. 生成已记录活动的简单摘要
  4. 如果您像我一样是严格的职场-生活平衡的人,则可以自动完成工作时间
  5. 可爱的名字
  6. Rust?

2. 用法

2.1. 使用CLI和帮助

#####
# CLI
#####
#The cli is structured as a bunch of subcommands.  Use --help to get detailed help for any subcommand (i.e. `ttjr show-config --help`)
$ ttjr --help
Usage: ttjr [OPTIONS] <COMMAND>

Commands:
  show-config      Set up DB and configure options Show config options and currently-registered-categories
  add-category     Create a new category that you can use for time tracking
  delete-category  Delete a category
  set-option       Set a global option
  unset-option     Remove an option
  start-timing     Start timing an activity - stops timing any currently running activities
  stop-timing      End timing
  amend-time       
  delete-time      
  export           Export the DB to a more friendly format for analysis
  help             Print this message or the help of the given subcommand(s)

Options:
      --db-path <DB_PATH>  [default: ttjr.sqlite3]
  -h, --help               Print help information
  -V, --version            Print version information

2.2. 设置您的Timetrack Jr.数据库

#########
# DB Setup
#########
#time is tracked under different categories
$ ttjr add-category project-for-client-a
$ ttjr add-category project-for-client-b
#if you want, you can set an end-of-day time which will automatically end any started time categories at 17:00
#turns out this is the only available option right now :)
$ ttjr set-option end-of-day 17:00
$ ttjr show-config
{
  "options": {
    "dbversion": "0.1.0",
    "end-of-day": "17:00"
  },
  "categories": [
    "project-for-client-a",
    "project-for-client-b"
  ]
}
#by default, times will be saved to an sqlite db in the current directory
$ ls
ttjr.sqlite3
#If you want it somewhere else, use --db-path like
$ ttjr --db-path ~/.ttjr.sqlite3 <COMMAND>

2.3. 记录一些时间!

######
# Start timing stuff!
######
#start working on something, add --notify to fire a desktop notification, useful if you bind `start-timing` commands to global keyboard shortcuts
$ ttjr start-timing project-for-client-a --notify
#hopefully do some work for a while...
#start working on something else (no need to explicitly stop timing)
$ ttjr start-timing project-for-client-b
#go get a sandwich
$ ttjr stop-timing 
#back to work little capitalist
$ ttjr start-timing project-for-client-a

2.4. 生成方便的已记录时间导出

######
# Export timing data to do something interesting with it!
######
#quick summary - use exact dates or human-readable date-like strings to constrain exports
$ ttjr export --format summary --start-time "14 days ago"
Tabulating results starting on/after Fri, 28 Oct 2022 19:18:02 -0400
Logged 3 activites for a total of 03:00
project-for-client-a:
  2 logs, 01:00 cumulative, 33.33% of total
project-for-client-b:
  1 logs, 02:00 cumulative, 66.67% of total

#Export time data as json, csv, or ical
$ ttjr export --format json
[
  {
    "id": 1,
    "category": "project-for-client-a",
    "start_time": 1667307600,
    "end_time": 1667311200
  },
  {
    "id": 2,
    "category": "project-for-client-b",
    "start_time": 1667311200,
    "end_time": 1667318400
  },
  {
    "id": 3,
    "category": "project-for-client-a",
    "start_time": 1667322000,
    "end_time": null
  }
]

#Have ttjr generate and keep up-to-date an ical file that you can pull into gcal/outlook/etc
#HOT TIP: export to an ical file in dropbox/gdrive/etc and publish it so you can point a web calendar at it!
$ ttjr export --format ical --outfile ~/my_times.ical --listen

2.5. 编辑和修正已记录时间

######
# Editing/amending times
######
#amend an entry in case you started or stopped it at the wrong time (or made it the wrong category)
$ ttjr amend-time 2 -s "2022-11-01 10:00" -e "2022-11-01 12:00"
#delete an entry
$ ttjr delete-time 3

3. 构建

$ cargo build --release
$ cp target/release/ttjr <wherever you keep your bins>

依赖关系

~27–54MB
~888K SLoC