dominikbraun / timetrace

A simple CLI for tracking your working time.
Apache License 2.0
700 stars 76 forks source link

Proposal: Project modules #53

Closed dominikbraun closed 3 years ago

dominikbraun commented 3 years ago

Project modules, also known as sub-projects, are a frequently requested feature. This is my proposal on how to implement them.

Proposal

The idea

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.

Creating a project module

The syntax is the same as for creating a "normal" project. The logic for creating the project remains unchanged - it will simply create a file called grind-beans@make-coffee.json internally.

timetrace create project grind-beans@make-coffee

Tracking time for a project module

The start logic remains unchanged as well.

timetrace start grind-beans@make-coffee

Filtering records for a module

Once #52 is implemented, the list records command has a --project flag for filtering projects. With project modules, the respective logic would have to take an @ into account and additionally filter by module.

timetrace list records --project grind-beans@make-coffee today

Implementation

As mentioned above, project modules are stored in the exact same way as projects. Our example module will be stored as grind-beans@make-coffee.json inside the projects directory.

To list all available modules of the project make-coffee, all "projects" - e.g. modules - suffixed with @make-coffee can be displayed.

aligator commented 3 years ago

Nice idea

dominikbraun commented 3 years ago

Basic module support has been introduced with timetrace v0.7.0.