jazzband / Watson

:watch: A wonderful CLI to track your time!
http://tailordev.github.io/Watson/
MIT License
2.45k stars 240 forks source link

Support subprojects via dot-syntax (`proj.subproj`) #375

Open joelostblom opened 4 years ago

joelostblom commented 4 years ago

Subprojects can currently be handled via tags, e.g. if I am writing the third chapter of my thesis (which I should be doing right now), I could type:

watson start thesis +ch3 +writing

However, there is a distinction between the tags here; while +writing is a tag I will reuse over and over again for different projects, +ch3 is unique for this project. With many such unique tags, the tag space can become cluttered quickly. Instead it would be nice to be able to write:

watson start thesis.ch3 +writing

And have it track ch3 as a subproject of thesis. Practically this would mean that commands such as report and aggregegate would include any time spend in this project both for the parent (thesis) and the child (thesis.ch3).

Are there any directly blocking considerations here? Would this syntax be incompatible with any existing behavior of whatson or could I open a PR on this (although probably not for the next little while).

This is mentioned in #145 as "project hierarchy", where the dot-syntax was also proposed in a comment, I'm opening this to track in a dedicated issue.

joelostblom commented 4 years ago

Another way of handling subprojects could be via special syntax in tags (e.g. leading underscore), and filter these from showing up in watson tags. This likely requires less effort to implement, but feels less natural.

svdHero commented 1 year ago

This feature is really needed. As @joelostblom already explained, subprojects and tags are orthogonal concepts. Both are important to generate meaningful reports.

In my use case, my company has a project "Miscellaneous Studies" on which I have to book all hours that cannot be assign to a customer project. However, for the reports to my supervisor and for my own sanity, I would like to keep track of the individual tasks / studies that go into the project MiscStudies. So it would be great to have subprojects like MiscStudies.StudyFoo or MiscStudies.StudyBar. It doesn't make sense to have a tag named StudyFoo, because this label makes only sense within MiscStudies.

Additionally, it would be bad UX to make the user think of adding a tag each time they want track a subproject. If subproject would be a concept of it's own, the CLI could even produce a meaningful error message if a project has subprojects and the user does a watson start MyProject instead of watson start MyProject.SubprojectFoo.

joelostblom commented 1 year ago

@svdHero I actually have had this working locally for a while but haven't had time to clean it up and make a PR. The syntax I am using for subprojects is a leading ., so a command could look like this e.g. watson start my-project .my-subproject +my-tag. The way it is stored internal is as a tag prefixed with a ., which is then filtered accordingly for subcommands. Not sure when I will have time to make a proper PR though, might not be until spring/summer.

pyrite357 commented 1 year ago

Ability to handle companies is also a desired feature. So what about going 3 levels deep like company.project.sub-project?