timewarrior icon indicating copy to clipboard operation
timewarrior copied to clipboard

cannot start tag names that are initial substrings of filenames in extensions dir

Open smemsh opened this issue 4 years ago • 0 comments

The syntax for timew start is

timew start [<date>] [<tag>...]

but if a tag name is used that matches initial substring of a report (in $TIMEWARRIORDB/extensions), it will be consumed by the parser and ignored as a tag name, even though it is an argument to 'start' and should be interpreted as a tag:

 $ echo '#!/bin/true' > extensions/foobar
 $ chmod 0755 extensions/foobar

 $ timew start foo
Tracking 
  Started 2021-10-20T22:52:40
  Current                  40
  Total               0:00:00

 $ timew start foo bar
Recorded 
  Started 2021-10-20T22:38:27
  Ended                 52:52
  Total               0:14:25
Tracking bar
  Started 2021-10-20T22:52:52
  Current                  52
  Total               0:00:00

There happens to be no extensions/bar* executable so bar is correctly interpreted as a tag name. Using one for the first arg that isn't recognized as an extension also works:

 $ timew start zoo bar
Recorded bar
  Started 2021-10-20T22:52:52
  Ended                 53:02
  Total               0:00:10
Note: 'zoo' is a new tag.
Tracking bar zoo
  Started 2021-10-20T22:53:02
  Current                  02
  Total               0:00:00

The canonical=foobar can be seen in debug output:

 $ timew rc.debug=1 start foo bar
CLI Parser
  _original_args
    timew rc.debug=1 start foo bar
  _args
    word basename='timew' raw='timew' BINARY 
    word name='debug' raw='rc.debug=1' value='1' ORIGINAL CONFIG 
    word canonical='start' raw='start' ORIGINAL CMD 
    word canonical='foobar' raw='foo' ORIGINAL EXT 
    word raw='bar' ORIGINAL FILTER TAG 

Tracking bar
  Started 2021-10-20T23:00:32
  Current                  32
  Total               0:00:00

smemsh avatar Oct 21 '21 06:10 smemsh