1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-07 22:04:23 +00:00

adding profile actions for #141

This commit is contained in:
deadc0de6
2019-06-02 13:50:31 +02:00
parent bebe6f5eae
commit 58dd284118
5 changed files with 145 additions and 3 deletions

View File

@@ -83,13 +83,14 @@ class CfgAggregator:
self._patch_keys_to_objs(self.profiles,
"dotfiles", self.get_dotfile)
# patch action in actions
# patch action in dotfiles actions
self._patch_keys_to_objs(self.dotfiles,
"actions", self._get_action_w_args)
# patch action in profiles actions
self._patch_keys_to_objs(self.profiles,
"actions", self._get_action_w_args)
# patch default actions in settings
# patch actions in settings default_actions
self._patch_keys_to_objs([self.settings],
"default_actions", self._get_action_w_args)
if self.debug:
@@ -254,6 +255,13 @@ class CfgAggregator:
"""return profiles"""
return self.profiles
def get_profile(self, key):
"""return profile by key"""
try:
return next(x for x in self.profiles if x.key == key)
except StopIteration:
return None
def get_dotfiles(self, profile=None):
"""return dotfiles dict for this profile key"""
if not profile: