mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 08:29:16 +00:00
add ability to add auto-generated dotdrop header in dotfiles
This commit is contained in:
@@ -35,6 +35,7 @@ class Templategen:
|
||||
variable_end_string=VAR_END,
|
||||
comment_start_string=COMMENT_START,
|
||||
comment_end_string=COMMENT_END)
|
||||
self.env.globals['header'] = self._header
|
||||
self.log = Logger()
|
||||
|
||||
def generate(self, src, profile):
|
||||
@@ -42,6 +43,10 @@ class Templategen:
|
||||
return ''
|
||||
return self._handle_file(src, profile)
|
||||
|
||||
def _header(self, prepend=''):
|
||||
"""add a comment usually in the header of a dotfile"""
|
||||
return '{}{}'.format(prepend, utils.header())
|
||||
|
||||
def _handle_file(self, src, profile):
|
||||
"""generate the file content from template"""
|
||||
filetype = utils.run(['file', '-b', src], raw=False, debug=self.debug)
|
||||
|
||||
Reference in New Issue
Block a user