From: Tomas Babej Date: Sat, 15 Aug 2015 02:05:09 +0000 (+0200) Subject: TaskWarrior: Rename config attribute to overrides X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/3928be287cd1cd84db996b41125435c62e03339e?ds=sidebyside TaskWarrior: Rename config attribute to overrides --- diff --git a/docs/index.rst b/docs/index.rst index 1dc90b7..17ea42a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -486,14 +486,14 @@ Setting custom configuration values By default, TaskWarrior uses configuration values stored in your .taskrc. To see what configuration value overrides are passed to each executed -task command, have a peek into ``config`` attribute of ``TaskWarrior`` object:: +task command, have a peek into ``overrides`` attribute of ``TaskWarrior`` object:: - >>> tw.config + >>> tw.overrides {'confirmation': 'no', 'data.location': '/home/tbabej/.task'} To pass your own configuration overrides, you just need to update this dictionary:: - >>> tw.config.update({'hooks': 'off'}) # tasklib will not trigger hooks + >>> tw.overrides.update({'hooks': 'off'}) # tasklib will not trigger hooks Creating hook scripts --------------------- diff --git a/tasklib/backends.py b/tasklib/backends.py index fbe3ba3..b2038be 100644 --- a/tasklib/backends.py +++ b/tasklib/backends.py @@ -105,7 +105,7 @@ class TaskWarrior(Backend): self._config = None self.version = self._get_version() - self.config = { + self.overrides = { 'confirmation': 'no', 'dependency.confirmation': 'no', # See TW-1483 or taskrc man page 'recurrence.confirmation': 'no', # Necessary for modifying R tasks @@ -123,15 +123,15 @@ class TaskWarrior(Backend): data_location = os.path.expanduser(data_location) if create and not os.path.exists(data_location): os.makedirs(data_location) - self.config['data.location'] = data_location + self.overrides['data.location'] = data_location self.tasks = TaskQuerySet(self) def _get_command_args(self, args, config_override=None): command_args = ['task', 'rc:{0}'.format(self.taskrc_location)] - config = self.config.copy() - config.update(config_override or dict()) - for item in config.items(): + overrides = self.overrides.copy() + overrides.update(config_override or dict()) + for item in overrides.items(): command_args.append('rc.{0}={1}'.format(*item)) command_args.extend(map(six.text_type, args)) return command_args