This content originally appeared on DEV Community and was authored by Dominik Braun
Since its initial release in May, a lot of powerful features have been added to timetrace, a simple time tracking CLI. I'm going to introduce some of the features present in timetrace v0.10.0 in this article.
Installing timetrace
If you're on macOS, you can simply use Homebrew:
brew tap dominikbraun/timetrace
brew install timetrace
timetrace is available for all major platforms. Check out the installation instructions and pick yours.
Basic usage: If you're new to timetrace, Tracking my working time using timetrace might be a good read. There also are detailed examples and the CLI reference.
? Project modules
With version 0.7.0, support for project modules has been added to timetrace. Project modules are sub-projects of an existing project.
For example, we could create a project called make-coffee
:
timetrace create project make-coffee
Project modules are the exact same thing as projects, expect that they can be associated with a parent project. This association is marked by an @
. For example, grind-beans@make-coffee
is a module of the project make-coffee
. Therefore, creating this project is fairly simple:
timetrace create project grind-beans@make-coffee
timetrace recognizes those modules. For example, when listing all records for a given project, its modules will be included:
timetrace list records today -p make-coffee
+-----+-------------------------+---------+-------+------------+
| # | PROJECT | START | END | BILLABLE |
+-----+-------------------------+---------+-------+------------+
| 1 | make-coffee | 08:28 | 08:35 | no |
| 2 | grind-beans@make-coffee | 08:25 | 08:27 | no |
+-----+-------------------------+---------+-------+------------+
To view all projects along with their modules, just run timetrace list projects
.
? Revert changes to projects and records
timetrace v0.8.0 introduced the --revert
flag for the edit project
, delete project
, edit record
and delete record
commands. It allows to restore the resource prior to its modification.
For example, let's delete the make-coffee
project:
timetrace delete project make-coffee
Oops! That shouldn't have happened. Let's restore the state of the project prior to the delete
command:
timetrace delete project make-coffee --revert
The --revert
flag reverts the change introduced by the previous command, thus our project exists again.
Edited or deleted records can be restored the exact same way. The following command will edit the newest record and lengthen it by 1 hour:
timetrace edit record latest --plus 1h
This will increase the end time of the records by 1 hour.
Hint: To get a list of the available records of today and the record key for editing them, use
timetrace list records today
.
If this was a mistake, reverting the previous command is very simple:
timetrace edit record latest --revert
The end time of the record will now be the same as before.
? An enhanced tracking status
The timetrace status
command got some love with timetrace v0.9.0 and v0.10.0, addressing some requested features.
First of all, status
now not only calculates the overall work time of the current day but also the overall break time. How long have you been taking breaks today? Take a look at the right column!
Print your custom status
It is also possible to print the tracking status in your custom format using the --format
flag. There is a pre-defined set of variables. For example, {project}
will be replaced with the name of the current project.
To print an output like Currently working on make-coffee - Worked today: 2h
, issue the following command:
timetrace status --format "Currently working on {project} - Worked today: {trackedTimeToday}"
Another new option is --output
. It allows the users to specify an output format. The default is the table shown above, but it is also possible to output the same data as JSON:
timetrace status --output json
This will produce the following output:
{
"project": "web-store",
"trackedTimeCurrent": "1h 45min",
"trackedTimeToday": "7h 30min",
"breakTimeToday": "0h 30min"
}
Note that the JSON keys are the same as the formatting variables used by --format
.
This also enables a simple Starship integration.
Now you're good to give those features a try, bookmark the project or provide some feedback!
This content originally appeared on DEV Community and was authored by Dominik Braun
Dominik Braun | Sciencx (2021-06-17T09:45:52+00:00) timetrace: New features of the time tracking CLI. Retrieved from https://www.scien.cx/2021/06/17/timetrace-new-features-of-the-time-tracking-cli/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.