From 03b908bcedb0bc36d4c8f5f9b1fc62271296417b Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Tue, 24 Feb 2015 16:55:03 -0500 Subject: [PATCH] Check TASKRC environment var, default to ~/.taskrc --- taskw/warrior.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/taskw/warrior.py b/taskw/warrior.py index a58da00..ab86a57 100644 --- a/taskw/warrior.py +++ b/taskw/warrior.py @@ -36,6 +36,10 @@ open = lambda fname, mode: codecs.open(fname, mode, "utf-8") +# Location of configuration file: either specified by TASKRC environment +# variable, or ~/.taskrc (default). +TASKRC = os.getenv("TASKRC", "~/.taskrc") + class TaskWarriorBase(with_metaclass(abc.ABCMeta, object)): """ The task warrior @@ -46,7 +50,7 @@ class TaskWarriorBase(with_metaclass(abc.ABCMeta, object)): def __init__( self, - config_filename="~/.taskrc", + config_filename=TASKRC, config_overrides=None, marshal=False ): @@ -159,7 +163,7 @@ def filter_by(self, func): return filtered @classmethod - def load_config(cls, config_filename="~/.taskrc", overrides=None): + def load_config(cls, config_filename=TASKRC, overrides=None): """ Load ~/.taskrc into a python dict >>> config = TaskWarrior.load_config() @@ -414,7 +418,7 @@ class TaskWarriorShellout(TaskWarriorBase): def __init__( self, - config_filename="~/.taskrc", + config_filename=TASKRC, config_overrides=None, marshal=False, ):