I’m releasing v0.2.0 of Journal today, a Python command line tool that I’ve created to help with keeping a journal for work/personal stuff! Check PyPi for the latest or do an upgrade install with pip,
pip install -U journal.
Main changes include:
- Support for viewing entries on a specific date and over a specific time period
- The ability to create multiple entries at once from the command line
- Python 2.5 compatibility (thanks to Tox)
Read on for more details.
Viewing Existing Entries
I’m hesitant to add a full human-date parsing library as a dependency, since I don’t need specific time based or future based dates, so I rolled my own. The date formats currently supported include:
- previous day increments: “1 day ago”, “a day ago”, “5 days ago”, “yesterday”, or “today”
- specific American date formats: “8/15”, “8/15/2011”, “5-6-2011”, or “August 15”
So you can now view specific entries for a day by using the flag
--view. Short tags work with these dates.
$ journal --view "yesterday" $ journal --view "12 days ago" $ journal --view "8/14" # Easiest way to view today $ journal -vt
And you can view all entries since a specific previous date, using the flag
--since. This is sparse output, dates without entries will be skipped quietly.
$ journal --since "yesterday" $ journal --since "7 days ago"
I am still thinking over adding week and month dates to the mix, along with any other reasonable human time formats. The
--since flags are modeled after Git’s log command, I’m thinking about adding in a
--until flag also, for doing specific ranges. Although, adding a week date range might cover that need better.
Viewing entries over multiple days might provide lots of output, so I would recommend using
more to paginate.
$ journal --since "100 days ago" | less
Adding Multiple Entries
You can add multiple entries at a time from the command line, which will get added together in the journal.
$ journal "Foo was compeleted" "Bar was completed, after foo" $ tail ~/.journal/2011.08.18.txt Thu 10:52:01 2011-08-18 -Foo was compeleted -Bar was completed, after foo
I felt simplifying multiple entry was useful, but a friend on Twitter remarked that using quotes felt limiting. I’m starting to agree with him and may change the main entry mode back to “single entry” mode, but capturing all args and not require quotes. It adds issues with semi-colons or single quotes getting caught by your shell, but maybe it’s worth it? This process is also leading me toward a config file, with sensible defaults, but configurable options for those interested.
I think for the next version, better listing options of existing journal entries would be useful. Having a config file to control entry options and date formatting preferences perhaps. Have thoughts on what you like or don’t like? Let me know in the comments!