1
0
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:
deadc0de6
2018-09-01 17:28:02 +02:00
parent 0d097c8a77
commit 33361ddea6
4 changed files with 136 additions and 3 deletions

View File

@@ -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)