From 0d590e987a01447df4bc01a0bc6331051fe4cefe Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sun, 2 Sep 2018 15:20:11 +0200 Subject: [PATCH] clean header --- README.md | 14 ++++---------- dotdrop/utils.py | 7 +------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index dbc59cd..946724a 100644 --- a/README.md +++ b/README.md @@ -654,29 +654,23 @@ These can then be used in any template with Dotdrop is able to insert a header in the generated dotfiles. This allows to remind anyone opening the file for editing that this file is managed by dotdrop. -The header provides additional information like the last update date/time and -dotdrop's version. -Here's an example of such an header: +Here's what it looks like: ``` -This dotfile is managed using dotdrop v0.19.2 / last updated 2018-09-01 00:01 +This dotfile is managed using dotdrop ``` -Such a header can be automatically added using jinja2 directive: +The header can be automatically added using jinja2 directive: ``` {{@@ header() @@}} ``` -Properly commenting the header in the dotfile is the responsability of the user +Properly commenting the header in templates is the responsability of the user as jinja2 has no way of knowing what is the proper char(s) used for comments. Either prepend the directive with the commenting char(s) used in the dotfile (for example `# {{@@ header() @@}}`) or provide it as an argument `{{@@ header('# ') @@}}`. The result is equivalent. -Remember that when using the header, comparing dotfiles will notice changes as the -temporary version generated to compare with the local dotfile will have a different -date and time. - ## Environment variables It's possible to access environment variables inside the templates. diff --git a/dotdrop/utils.py b/dotdrop/utils.py index 7207ef0..4ad928d 100644 --- a/dotdrop/utils.py +++ b/dotdrop/utils.py @@ -9,7 +9,6 @@ import subprocess import tempfile import os import shlex -import datetime from shutil import rmtree # local import @@ -70,8 +69,4 @@ def samefile(path1, path2): def header(): - header = 'This dotfile is managed using dotdrop' - header += ' v{}'.format(VERSION) - now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") - header += ' / last updated {}'.format(now) - return header + return 'This dotfile is managed using dotdrop'