Small diary/calendar script for the Bash shell. Written in python3 (3.7+).
- Calendar events are stored as a JSON array in
events.json
- Each event has a title, date and location (optional)
- Run
diary -a
from the command line to add a new event to the events file diary X
prints events in the diary occurring withinX
days (default 7)diary -d X
May be used to remove events in the diary occurring withinX
daysdiary -h
prints a summary of the usage and set-updiary -s
saves all events in the diary to a text file in a nice format
- Create an alias in your
~/.bashrc
with the following line
alias diary="python full_path_to_diary.py"
For example, alias diary="python /home/username/diary-folder/diary.py"
(here python
is your python 3 executable - python3
on some systems).
Otherwise, the script must always be run with python full_path_to_diary.py
.
In order to change the formats used when entering a date and time for an event (-a
), edit the DATE_FORMAT
and TIME_FORMAT
class variables near the top of the Diary
class in diary.py
. To change the formatting used when printing time and dates to the console instead edit the LONG_DATE_FORMAT
and LONG_TIME_FORMAT
variables (details found in the class docstring). Each of these variables must be a valid directive for the strftime
directive from the datetime
module. THe official docs provide a reference for the accepted format codes: 8.1.8. strftime() and strptime() Behavior.
- Ability to edit events in the diary
- 'Repeat' field to have events automatically repeat after a certain number of hours/days
- Additional fields such as event description, duration and company
- Events now stored as a JSON array instead of a JSON object
- Can now have arbitrary many events with the same title (or time, date etc.)
- No longer breaks if
event.json
contains an empty JSON array (i.e. user has no events).
- Added
-s
option to saved events tosaved_events
in a human readable format. Events are grouped by year.
- Added
-d
option to remove events from the diary within a certain number of days - Number of events may now be negative (view/delete events in the past)
-v
option to display version number
- Re-write of script to improve structure and extensibility
- Events now have a single 'ISO' field - an iso-formatted string - instead of separate date and time fields
event.json
is now created automatically on first run of the script- Better handling of command line options (only one allowed per time)
- Usage message moved into main class;
diary.py
is the only file required now - Ability to use different date/time formats via class variables
- Events can now be set to repeat after a certain number of days