Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should arguments that begin with ':' be reserved for hints? #348

Open
sruffell opened this issue Jul 24, 2020 · 2 comments · May be fixed by #363
Open

Should arguments that begin with ':' be reserved for hints? #348

sruffell opened this issue Jul 24, 2020 · 2 comments · May be fixed by #363
Labels
discussion Discussion on a topic

Comments

@sruffell
Copy link
Contributor

The following output surprised me:

$ src/timew track :yesterday foo
Note: 'foo' is a new tag.
Recorded foo
  Started 2020-07-23T00:00:00
  Ended           24T00:00:00
  Total              24:00:00
$ src/timew track :today bar
Note: ':today' is a new tag.
Note: 'bar' is a new tag.
Tracking :today bar
  Started 2020-07-24T14:43:52
  Current                  52
  Total               0:00:00

My question is should any command line argument that begins with a : be interpreted as a hint, and display an error that there is no hint with that name instead of treating it as a tag?

@lauft lauft added the discussion Discussion on a topic label Aug 7, 2020
@lauft
Copy link
Member

lauft commented Aug 7, 2020

@sruffell, I agree. I guess we gain more clarity by restricting : to hints than breaking existing behaviour/workflows because someone starts their tags like this.

The problem here also seems to be that there is a :yesterday hint but not a :today as one might deduce.
Without ":" on the other hand, it works with both:

$ timew start yesterday FOO
Note: 'FOO' is a new tag.
Tracking FOO
  Started 2020-08-06T00:00:00
  Current         07T16:12:49
  Total              40:12:49
$ timew start today BAR
Recorded FOO
  Started 2020-08-06T00:00:00
  Ended           07T00:00:00
  Total              24:00:00
Note: 'BAR' is a new tag.
Tracking BAR
  Started 2020-08-07T00:00:00
  Current            16:12:55
  Total              16:12:55

sruffell added a commit to sruffell/timewarrior that referenced this issue Aug 13, 2020
Currently, any argument that starts with ':' that isn't a known hint
will be treated as a tag. After this change, an error is produced.

Hopefully there were not users who were using tags that start with a
colon...

Closes GothenburgBitFactory#348
sruffell added a commit to sruffell/timewarrior that referenced this issue Aug 13, 2020
Currently, any argument that starts with ':' that isn't a known hint
will be treated as a tag. After this change, an error is produced.

Hopefully there were not users who were using tags that start with a
colon...

Closes GothenburgBitFactory#348
@sruffell sruffell linked a pull request Aug 13, 2020 that will close this issue
sruffell added a commit to sruffell/timewarrior that referenced this issue Aug 13, 2020
Currently, any argument that starts with ':' that isn't a known hint
will be treated as a tag. After this change, an error is produced.

Hopefully there were not users who were using tags that start with a
colon...

Closes GothenburgBitFactory#348

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
@sruffell
Copy link
Contributor Author

The problem here also seems to be that there is a :yesterday hint but not a :today as one might deduce.

I pushed the change to error on unknown hints, but I agree with the above. It almost seems to me that range hints should always begin with a colon, but that would complicate the date parsing. 🤔

sruffell added a commit to sruffell/timewarrior that referenced this issue Aug 14, 2020
Currently, any argument that starts with ':' that isn't a known hint
will be treated as a tag. After this change, an error is produced.

Hopefully there were not users who were using tags that start with a
colon...

Closes GothenburgBitFactory#348

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
sruffell added a commit to sruffell/timewarrior that referenced this issue Aug 25, 2020
Currently, any argument that starts with ':' that isn't a known hint
will be treated as a tag. After this change, an error is produced.

Hopefully there were not users who were using tags that start with a
colon...

Closes GothenburgBitFactory#348

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussion on a topic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants