Skip to content

Commit

Permalink
Merge pull request #95 from khaeru/develop
Browse files Browse the repository at this point in the history
Check TASKRC environment var, default to ~/.taskrc
  • Loading branch information
ralphbean committed Feb 24, 2015
2 parents 57939f4 + 03b908b commit 17133f2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions taskw/warrior.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
):
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -414,7 +418,7 @@ class TaskWarriorShellout(TaskWarriorBase):

def __init__(
self,
config_filename="~/.taskrc",
config_filename=TASKRC,
config_overrides=None,
marshal=False,
):
Expand Down

0 comments on commit 17133f2

Please sign in to comment.