A simple CLI for tracking your working time.
:alarm_clock: timetrace
timetrace is a simple CLI for tracking your working time.
:fire: New: Add tags for records
:fire: New: Use decimal hours when displaying durations
:fire: New: Restore records when restoring the associated project
:fire: New: Support for per-project configuration
brew tap dominikbraun/timetrace
brew install timetracesudo snap install timetrace --edge --devmodeyay -S timetrace-binscoop bucket add https://github.com/Br1ght0ne/scoop-bucket
scoop install timetraceThe timetrace Docker image stores all data in the /data directory. To persist
this data on disk, you should create a bind mount or named volume like so:
docker container run -v my-volume:/data dominikbraun/timetrace versionDownload the latest release
and extract the binary into a directory like /usr/local/bin or
C:\Program Files\timetrace. Make sure the directory is in the PATH variable.
First, create a project you're working for:
timetrace create project make-coffeeOnce the project is created, you're able to track work on that project.
timetrace start make-coffeeYou can obtain your currently worked time using timetrace status. When you've
finished your work, stop tracking:
timetrace stopTo refine what part of a project you're working on, timetrace supports project modules. These are the exact same thing
as normal projects, except that they have a key in the form @.
Creating a grind-beans module for the make-coffee project is simple:
timetrace create project grind-beans@make-coffeeThe new module will be listed as part of the make-coffee project:
timetrace list projects
+-----+-------------+-------------+
| # | KEY | MODULES |
+-----+-------------+-------------+
| 1 | make-coffee | grind-beans |
+-----+-------------+-------------+
When filtering by projects, for example with timetrace list records -p make-coffee today, the modules of that project
will be included.
To integrate timetrace into Starship, add the following lines to $HOME/.config/starship.toml:
[custom.timetrace]
command = """ timetrace status --format "Current project: {project} - Worked today: {trackedTimeToday}" """
when = "timetrace status"
shell = "sh"You can find a list of available formatting variables in the status reference.
Syntax:
timetrace start [+TAG1, +TAG2, ...]Arguments:
| Argument | Description |
|---|---|
PROJECT KEY |
The key of the project. |
+TAG1, +TAG2, ... |
One or more optional tags starting with +. |
Flags:
| Flag | Short | Description |
|---|---|---|
--billable |
-b |
Mark the record as billable. |
--non-billable |
Mark the record as non-billable, even if the project is billable by default. |
Example:
Start working on a project called make-coffee and mark it as billable:
timetrace start --billable make-coffeeStart working on the make-coffee project and add two tags:
timetrace start make-coffee +espresso +morningSyntax:
timetrace statusFlags:
| Flag | Short | Description |
|---|---|---|
--format |
-f |
Display the status in a custom format (see below). |
--output |
-o |
Display the status in a specific output. Valid values: json |
Formatting variables:
The names of the formatting variables are the same as the JSON keys printed by --output json.
| Variable | Description |
|---|---|
{project} |
The key of the current project. |
{trackedTimeCurrent} |
The time tracked for the current record. |
{trackedTimeToday} |
The time tracked today. |
{breakTimeToday} |
The break time since the first record. |
Example:
Print the current tracking status:
timetrace status
+-------------------+----------------------+----------------+
| CURRENT PROJECT | WORKED SINCE START | WORKED TODAY |
+-------------------+----------------------+----------------+
| make-coffee | 1h 15min | 4h 30min |
+-------------------+----------------------+----------------+Print the current project and the total working time as a custom string. Given the example above, the output will be
Current project: make-coffee - Worked today: 3h 30min.
timetrace status --format "Current project: {project} - Worked today: {trackedTimeToday}"Print the status as JSON:
timetrace status -o jsonThe output will look as follows:
{
"project": "web-store",
"trackedTimeCurrent": "1h 45min",
"trackedTimeToday": "7h 30min",
"breakTimeToday": "0h 30min"
}Syntax:
timetrace stopExample:
Stop working on your current project:
timetrace stopSyntax:
timetrace create project Arguments:
| Argument | Description |
|---|---|
KEY |
An unique project key. |
Example:
Create a project called make-coffee:
timetrace create project make-coffee:warning: You shouldn't use this command for normal tracking but only for belated records.
Syntax:
timetrace create record {|today|yesterday} Arguments:
| Argument | Description |
|---|---|
PROJECT KEY |
The project key the record should be created for. |
YYYY-MM-DD |
The date the record should be created for. Alternatively today or yesterday. |
HH:MM |
The start time of the record. |
HH:MM |
The end time of the record. |
Example:
Create a record for the make-coffee project today from 07:00 to 08:30:
timetrace create record make-coffee today 07:00 08:30Syntax:
timetrace get project Arguments:
| Argument | Description |
|---|---|
KEY |
The project key. |
Example:
Display a project called make-coffee:
timetrace get project make-coffeeSyntax:
timetrace get record Arguments:
| Argument | Description |
|---|---|
YYYY-MM-DD-HH-MM |
The start time of the desired record. |
Example:
By default, records can be accessed using the 24-hour format, meaning 3:00 PM is 15. Display a record created on May 1st 2021, 3:00 PM:
timetrace get record 2021-05-01-15-00This behavior can be changed.
Syntax:
timetrace list projectsExample:
List all projects stored within the timetrace filesystem:
timetrace list projects
+---+-------------+
| # | KEY |
+---+-------------+
| 1 | make-coffee |
| 2 | my-website |
| 3 | web-shop |
+---+-------------+Syntax:
timetrace list records {|today|yesterday}Arguments:
| Argument | Description |
|---|---|
YYYY-MM-DD |
The date of the records to list, or today or yesterday. |
| today | List today's records. |
| yesterday | List yesterday's records. |
Flags:
| Flag | Short | Description |
|---|---|---|
--billable |
-b |
only display billable records. |
--project |
-p |
filter records by project key. |
Example:
Display all records created on May 1st 2021:
timetrace list records 2021-05-01
+-----+-------------+---------+-------+------------+
| # | PROJECT | START | END | BILLABLE |
+-----+-------------+---------+-------+------------+
| 1 | my-website | 17:30 | 21:00 | yes |
| 2 | my-website | 08:31 | 17:00 | no |
| 3 | make-coffee | 08:25 | 08:30 | no |
+-----+-------------+---------+-------+------------+Filter records by the make-coffee project:
timetrace list records -p make-coffee 2021-05-01
+-----+-------------+---------+-------+------------+
| # | PROJECT | START | END | BILLABLE |
+-----+-------------+---------+-------+------------+
| 1 | make-coffee | 08:25 | 08:30 | no |
+-----+-------------+---------+-------+------------+This will include records for project modules like grind-beans@make-coffee.
Syntax:
timetrace edit project Arguments:
| Argument | Description |
|---|---|
KEY |
The project key. |
Flags:
| Flag | Short | Description |
|---|---|---|
--revert |
-r |
Revert the project to its state prior to the last edit. |
Example:
Edit a project called make-coffee:
timetrace edit project make-coffeeNo open issues yet, or sync has not completed.