From be1a90db3d1c01ac5ed74fcbf8110e8729e203de Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Mon, 30 Jun 2014 10:26:54 +0200 Subject: [PATCH] Version bump & new recipes --- CHANGELOG.md | 1 + docs/recipes.rst | 34 ++++++++++++++++++++++++++++++++++ jrnl/__init__.py | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f39fbf4..1ebae8f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog ### 1.8 (May 22, 2014) +* __1.8.5__ Fixed: file names when exporting to individual files contain full year (thanks to @jdevera) * __1.8.4__ Improved: using external editors (thanks to @chrissexton) * __1.8.3__ Fixed: export to text files and improves help (thanks to @igniteflow and @mpe) * __1.8.2__ Better integration with environment variables (thanks to @ajaam and @matze) diff --git a/docs/recipes.rst b/docs/recipes.rst index ffcc0643..98fce943 100644 --- a/docs/recipes.rst +++ b/docs/recipes.rst @@ -37,6 +37,40 @@ Will give you the number of words you wrote in 2013. How long is my average entr This will first get the total number of words in the journal and divide it by the number of entries (this works because ``jrnl --short`` will print exactly one line per entry). +Importing older files +~~~~~~~~~~~~~~~~~~~~~ + +If you want to import a file as an entry to jrnl, you can just do ``jrnl < entry.ext``. But what if you want the modification date of the file to be the date of the entry in jrnl? Try this :: + + echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' entry.txt` `cat entry.txt` | jrnl + +The first part will format the modification date of ``entry.txt``, and then combine it with the contents of the file before piping it to jrnl. If you do that often, consider creating a function in your ``.bashrc`` or ``.bash_profile`` :: + + jrnlimport () { + echo `stat -f %Sm -t '%d %b %Y at %H:%M: ' $1` `cat $1` | jrnl + } + + +Using templates +~~~~~~~~~~~~~~~ + +Say you always want to use the same template for creating new entries. If you have an :doc:`external editor ` set up, you can use this :: + + jrnl < my_template.txt + jrnl -1 --edit + +Another nice solution that allows you to define individual prompts comes from `Jacobo de Vera `_ :: + + function log_question() + { + echo $1 + read + jrnl today: ${1}. $REPLY + } + log_question 'What did I achieve today?' + log_question 'What did I make progress with?' + + External editors ---------------- diff --git a/jrnl/__init__.py b/jrnl/__init__.py index 260d7f10..0984ff98 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line. from __future__ import absolute_import __title__ = 'jrnl' -__version__ = '1.8.4' +__version__ = '1.8.5' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 - 2014 Manuel Ebert'