GothenburgBitFactory / tasklib

A Python library for interacting with taskwarrior databases.
http://tasklib.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
146 stars 27 forks source link

Added save_config method to taskwarrior backend #57

Closed lyz-code closed 6 years ago

lyz-code commented 6 years ago

I've added the save_config method to the backend class so as to be able to save the config state loaded in tasklib into the taskrc path.

So as to be able to persist the changes made in the config by tasklib.

I've also found a bug in the .config property where it took the lines Some of your .taskrc variables differ from the default values. and Your .taskrc file contains these unrecognized variables: as valid configurations giving:

self.config['Some'] == 'of your .taskrc variables differ from the default values.'
self.config['Your'] == '.taskrc file contains these unrecognized variables:'

self.config was set as an ReadOnlyDictView therefore I was unable to edit it on the fly, I've also converted it to a regular dictionary

robgolding commented 6 years ago

Thanks for the PR, and sorry for the delay, but I unfortunately don't think this is mergeable. It will reformat the config file entirely on save, and the order of dicts is also not guaranteed. I don't really think config editing is a feature we want to add, I'm afraid 😕