Open arooni opened 2 years ago
@arooni I think you should be able to use ~
in place of /home/arooni/
, i.e.
import ~/.timewarrior/dark.theme
should work on both platforms.
maybe a different issue, but it also doesn't work if the path specified is outside $TIMEWARRIORDB (mine is ~/.task
), looks like somehow it's splitting it up two different ways... I added some prints in Rules::parse()
at firstWord == "import"
and, if the path is inside the dir:
# import /home/scott/.task/foo.bar
IMPORT tokens.size: 2
IMPORT tokens: import, /home/scott/.task/foo.bar,
but if it's outside the dir:
# import /home/scott/foo.bar
IMPORT tokens.size: 7
IMPORT tokens: import, /, home, /, scott, /, foo.bar,
latter case fails tokens.size() == 2
test, so it's never considered a candidate for import routines
It seems ~
is only expanded for paths. When loading the rules file, this is done for the given filename. However, for imports the token after import
has to have been recognized as type 'path' by the Lexer.
In the Lexer I found the rule that a token is only recognized as type 'path' if it starts with a /
and also contains more than 3 of them.
The latter explains why @smemsh file was not imported if it was "outside the dir".
This might be an (ugly) workaround:
# import /home/scott/../scott/foo.bar
Ah ok, so it's not being inside $TIMEWARRIORDB at all but just that it has enough slashes? nice. Indeed, import /tmp/test/foo/testfile
works
Currently all import statements appear to be limited to absolute paths.
I use timewarrior/taskwarrior on Ubuntu linux, but also on my Mac. The home directories are slightly different so it'd be nice to allow for one config file to be used on both for ease of use and consistency. However, I seem to have to create a separate absolute path entry for my Mac then for my Ubuntu machine
I have to comment out one entry depending on which platform. Relative path support would solve this