mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-06 04:23:01 +00:00
implement global upignore/cmpignore for #122
This commit is contained in:
@@ -36,6 +36,8 @@ class Cfg:
|
||||
key_workdir = 'workdir'
|
||||
key_import_vars = 'import_variables'
|
||||
key_import_actions = 'import_actions'
|
||||
key_cmpignore = 'cmpignore'
|
||||
key_upignore = 'upignore'
|
||||
|
||||
# actions keys
|
||||
key_actions = 'actions'
|
||||
@@ -138,6 +140,11 @@ class Cfg:
|
||||
self.ext_variables = {}
|
||||
self.ext_dynvariables = {}
|
||||
|
||||
# cmpignore patterns
|
||||
self.cmpignores = []
|
||||
# upignore patterns
|
||||
self.upignores = []
|
||||
|
||||
if not self._load_config(profile=profile):
|
||||
raise ValueError('config is not valid')
|
||||
|
||||
@@ -242,6 +249,14 @@ class Cfg:
|
||||
paths = self.lnk_settings[self.key_import_vars]
|
||||
self._load_ext_variables(paths, profile=profile)
|
||||
|
||||
# load global upignore
|
||||
if self.key_upignore in self.lnk_settings:
|
||||
self.upignores = self.lnk_settings[self.key_upignore] or []
|
||||
|
||||
# load global cmpignore
|
||||
if self.key_cmpignore in self.lnk_settings:
|
||||
self.cmpignores = self.lnk_settings[self.key_cmpignore] or []
|
||||
|
||||
# parse external actions
|
||||
if self.key_import_actions in self.lnk_settings:
|
||||
for path in self.lnk_settings[self.key_import_actions]:
|
||||
@@ -360,10 +375,12 @@ class Cfg:
|
||||
# parse cmpignore pattern
|
||||
cmpignores = v[self.key_dotfiles_cmpignore] if \
|
||||
self.key_dotfiles_cmpignore in v else []
|
||||
cmpignores.extend(self.cmpignores)
|
||||
|
||||
# parse upignore pattern
|
||||
upignores = v[self.key_dotfiles_upignore] if \
|
||||
self.key_dotfiles_upignore in v else []
|
||||
upignores.extend(self.upignores)
|
||||
|
||||
# create new dotfile
|
||||
self.dotfiles[k] = Dotfile(k, dst, src,
|
||||
|
||||
Reference in New Issue
Block a user