mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 02:04:15 +00:00
adding notemplate config options
This commit is contained in:
@@ -58,6 +58,7 @@ class CfgYaml:
|
|||||||
key_dotfile_actions = 'actions'
|
key_dotfile_actions = 'actions'
|
||||||
key_dotfile_link_children = 'link_children'
|
key_dotfile_link_children = 'link_children'
|
||||||
key_dotfile_noempty = 'ignoreempty'
|
key_dotfile_noempty = 'ignoreempty'
|
||||||
|
key_dotfile_notemplate = 'notemplate'
|
||||||
|
|
||||||
# profile
|
# profile
|
||||||
key_profile_dotfiles = 'dotfiles'
|
key_profile_dotfiles = 'dotfiles'
|
||||||
@@ -83,6 +84,7 @@ class CfgYaml:
|
|||||||
key_settings_noempty = Settings.key_ignoreempty
|
key_settings_noempty = Settings.key_ignoreempty
|
||||||
key_settings_minversion = Settings.key_minversion
|
key_settings_minversion = Settings.key_minversion
|
||||||
key_imp_link = Settings.key_link_on_import
|
key_imp_link = Settings.key_link_on_import
|
||||||
|
key_settings_notemplate = Settings.key_template_dotfile_default
|
||||||
|
|
||||||
# link values
|
# link values
|
||||||
lnk_nolink = LinkTypes.NOLINK.name.lower()
|
lnk_nolink = LinkTypes.NOLINK.name.lower()
|
||||||
@@ -597,6 +599,10 @@ class CfgYaml:
|
|||||||
if self.key_dotfile_noempty not in v:
|
if self.key_dotfile_noempty not in v:
|
||||||
val = self.settings.get(self.key_settings_noempty, False)
|
val = self.settings.get(self.key_settings_noempty, False)
|
||||||
v[self.key_dotfile_noempty] = val
|
v[self.key_dotfile_noempty] = val
|
||||||
|
# apply notemplate if undefined
|
||||||
|
if self.key_dotfile_notemplate not in v:
|
||||||
|
val = self.settings.get(self.key_settings_notemplate, False)
|
||||||
|
v[self.key_dotfile_notemplate] = val
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def _add_variables(self, new, shell=False, template=True, prio=False):
|
def _add_variables(self, new, shell=False, template=True, prio=False):
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ class Dotfile(DictParser):
|
|||||||
key_noempty = 'ignoreempty'
|
key_noempty = 'ignoreempty'
|
||||||
key_trans_r = 'trans_read'
|
key_trans_r = 'trans_read'
|
||||||
key_trans_w = 'trans_write'
|
key_trans_w = 'trans_write'
|
||||||
|
key_notemplate = 'notemplate'
|
||||||
|
|
||||||
def __init__(self, key, dst, src,
|
def __init__(self, key, dst, src,
|
||||||
actions=[], trans_r=None, trans_w=None,
|
actions=[], trans_r=None, trans_w=None,
|
||||||
link=LinkTypes.NOLINK, noempty=False,
|
link=LinkTypes.NOLINK, noempty=False,
|
||||||
cmpignore=[], upignore=[],
|
cmpignore=[], upignore=[],
|
||||||
instignore=[]):
|
instignore=[], notemplate=False):
|
||||||
"""
|
"""
|
||||||
constructor
|
constructor
|
||||||
@key: dotfile key
|
@key: dotfile key
|
||||||
@@ -35,6 +36,7 @@ class Dotfile(DictParser):
|
|||||||
@upignore: patterns to ignore when updating
|
@upignore: patterns to ignore when updating
|
||||||
@cmpignore: patterns to ignore when comparing
|
@cmpignore: patterns to ignore when comparing
|
||||||
@instignore: patterns to ignore when installing
|
@instignore: patterns to ignore when installing
|
||||||
|
@notemplate: disable template for this dotfile
|
||||||
"""
|
"""
|
||||||
self.actions = actions
|
self.actions = actions
|
||||||
self.dst = dst
|
self.dst = dst
|
||||||
@@ -47,6 +49,7 @@ class Dotfile(DictParser):
|
|||||||
self.upignore = upignore
|
self.upignore = upignore
|
||||||
self.cmpignore = cmpignore
|
self.cmpignore = cmpignore
|
||||||
self.instignore = instignore
|
self.instignore = instignore
|
||||||
|
self.notemplate = notemplate
|
||||||
|
|
||||||
if self.link != LinkTypes.NOLINK and \
|
if self.link != LinkTypes.NOLINK and \
|
||||||
(
|
(
|
||||||
@@ -91,10 +94,12 @@ class Dotfile(DictParser):
|
|||||||
value['noempty'] = value.get(cls.key_noempty, False)
|
value['noempty'] = value.get(cls.key_noempty, False)
|
||||||
value['trans_r'] = value.get(cls.key_trans_r)
|
value['trans_r'] = value.get(cls.key_trans_r)
|
||||||
value['trans_w'] = value.get(cls.key_trans_w)
|
value['trans_w'] = value.get(cls.key_trans_w)
|
||||||
|
value['notemplate'] = value.get(cls.key_notemplate, False)
|
||||||
# remove old entries
|
# remove old entries
|
||||||
value.pop(cls.key_noempty, None)
|
value.pop(cls.key_noempty, None)
|
||||||
value.pop(cls.key_trans_r, None)
|
value.pop(cls.key_trans_r, None)
|
||||||
value.pop(cls.key_trans_w, None)
|
value.pop(cls.key_trans_w, None)
|
||||||
|
value.pop(cls.key_notemplate, None)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
@@ -114,6 +119,7 @@ class Dotfile(DictParser):
|
|||||||
out += '\n{}src: \"{}\"'.format(indent, self.src)
|
out += '\n{}src: \"{}\"'.format(indent, self.src)
|
||||||
out += '\n{}dst: \"{}\"'.format(indent, self.dst)
|
out += '\n{}dst: \"{}\"'.format(indent, self.dst)
|
||||||
out += '\n{}link: \"{}\"'.format(indent, str(self.link))
|
out += '\n{}link: \"{}\"'.format(indent, str(self.link))
|
||||||
|
out += '\n{}notemplate: \"{}\"'.format(indent, str(self.notemplate))
|
||||||
|
|
||||||
out += '\n{}pre-action:'.format(indent)
|
out += '\n{}pre-action:'.format(indent)
|
||||||
some = self.get_pre_actions()
|
some = self.get_pre_actions()
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class Settings(DictParser):
|
|||||||
key_func_file = 'func_file'
|
key_func_file = 'func_file'
|
||||||
key_filter_file = 'filter_file'
|
key_filter_file = 'filter_file'
|
||||||
key_diff_command = 'diff_command'
|
key_diff_command = 'diff_command'
|
||||||
|
key_template_dotfile_default = 'template_dotfile_default'
|
||||||
|
|
||||||
# import keys
|
# import keys
|
||||||
key_import_actions = 'import_actions'
|
key_import_actions = 'import_actions'
|
||||||
@@ -49,7 +50,8 @@ class Settings(DictParser):
|
|||||||
upignore=[], cmpignore=[], instignore=[],
|
upignore=[], cmpignore=[], instignore=[],
|
||||||
workdir='~/.config/dotdrop', showdiff=False,
|
workdir='~/.config/dotdrop', showdiff=False,
|
||||||
minversion=None, func_file=[], filter_file=[],
|
minversion=None, func_file=[], filter_file=[],
|
||||||
diff_command='diff -r -u {0} {1}'):
|
diff_command='diff -r -u {0} {1}',
|
||||||
|
template_dotfile_default=False):
|
||||||
self.backup = backup
|
self.backup = backup
|
||||||
self.banner = banner
|
self.banner = banner
|
||||||
self.create = create
|
self.create = create
|
||||||
@@ -72,6 +74,7 @@ class Settings(DictParser):
|
|||||||
self.func_file = func_file
|
self.func_file = func_file
|
||||||
self.filter_file = filter_file
|
self.filter_file = filter_file
|
||||||
self.diff_command = diff_command
|
self.diff_command = diff_command
|
||||||
|
self.template_dotfile_default = template_dotfile_default
|
||||||
|
|
||||||
def _serialize_seq(self, name, dic):
|
def _serialize_seq(self, name, dic):
|
||||||
"""serialize attribute 'name' into 'dic'"""
|
"""serialize attribute 'name' into 'dic'"""
|
||||||
@@ -94,6 +97,7 @@ class Settings(DictParser):
|
|||||||
self.key_workdir: self.workdir,
|
self.key_workdir: self.workdir,
|
||||||
self.key_minversion: self.minversion,
|
self.key_minversion: self.minversion,
|
||||||
self.key_diff_command: self.diff_command,
|
self.key_diff_command: self.diff_command,
|
||||||
|
self.key_template_dotfile_default: self.template_dotfile_default,
|
||||||
}
|
}
|
||||||
self._serialize_seq(self.key_default_actions, dic)
|
self._serialize_seq(self.key_default_actions, dic)
|
||||||
self._serialize_seq(self.key_import_actions, dic)
|
self._serialize_seq(self.key_import_actions, dic)
|
||||||
|
|||||||
Reference in New Issue
Block a user