timewarrior icon indicating copy to clipboard operation
timewarrior copied to clipboard

Make extension configurable via timewarrior config file

Open AMNeumann opened this issue 5 years ago • 5 comments

It would be really nice to make extensions configurable via the timewarrior config file, e.g. configuring

ext.myreport.foo = bar

in the config file should yield

myreport.foo: bar

in the extension's input. I would also be fine with

ext.myreport.foo: bar

in the input.

AMNeumann avatar Sep 07 '20 11:09 AMNeumann

Timewarrior already passes all its configuration to the extension when called.

You can check this by installing the debug.py report that comes with Timewarrior:

$ timew config ext.myreport.foo bar :yes
$ timew show
color = on
confirmation = on
debug = off

ext:
  myreport:
    foo = bar
... # output shortened for brevity
$ timew debug
color: on
confirmation: on
debug: off
ext.myreport.foo: bar
... # output shortened for brevity

Your report can then extract the value from the line ext.myreport.foo: bar.

lauft avatar Sep 07 '20 18:09 lauft

I built Timewarrior 1.4.2 from source:

git clone https://github.com/GothenburgBitFactory/timewarrior.git /timewarrior && \ cd /timewarrior && sed -i 's/git.tasktools.org\/TM/github.com\/GothenburgBitFactory/' .gitmodules && \ git submodule init && git submodule update && \ mkdir /build-timewarrior && cd /build-timewarrior && cmake -DCMAKE_BUILD_TYPE=Release /timewarrior && make && make install

I then wrote an extension that prints out the configuration (among other things of course) and the extension does not get the values from taskwarrior.cfg. I can, however, pass values via the command line using e.g. rc.foo=bar.

AMNeumann avatar Sep 08 '20 02:09 AMNeumann

@AMNeumann, could you install the debug extension that comes with Timewarrior, repeat the commands I stated above and post the output (maybe purge it of private data before)?

$ timew config ext.myreport.foo bar :yes
$ timew show
$ timew debug

This could help debugging the issue.

lauft avatar Sep 09 '20 08:09 lauft

I then wrote an extension that prints out the configuration (among other things of course) and the extension does not get the values from taskwarrior.cfg. I can, however, pass values via the command line using e.g. rc.foo=bar.

You have written taskwarrior.cfg instead of timewarrior.cfg. Have you placed your configuration in the correct configuration file?

chrko avatar Oct 21 '20 20:10 chrko

Note: also discussed in #230 (may be an opportunity to document this usage)

srl295 avatar Apr 02 '21 16:04 srl295