Release 1.19.1
[dotbot.git] / dotbot / context.py
blobda10ba44ba3e76f2346cc626c38bc8222accb06a
1 import copy
2 import os
3 from argparse import Namespace
6 class Context(object):
7 """
8 Contextual data and information for plugins.
9 """
11 def __init__(self, base_directory, options=Namespace()):
12 self._base_directory = base_directory
13 self._defaults = {}
14 self._options = options
15 pass
17 def set_base_directory(self, base_directory):
18 self._base_directory = base_directory
20 def base_directory(self, canonical_path=True):
21 base_directory = self._base_directory
22 if canonical_path:
23 base_directory = os.path.realpath(base_directory)
24 return base_directory
26 def set_defaults(self, defaults):
27 self._defaults = defaults
29 def defaults(self):
30 return copy.deepcopy(self._defaults)
32 def options(self):
33 return copy.deepcopy(self._options)