📜 ⬆️ ⬇️

Event Reminder with HolidaySH

Hi, Habr!

The other day I wrote a script to alert various events: birthdays, tasks.
Today I sat down and designed a flexible console program for notifying completely different types of events on patterns that you can add.

And so, before you HolidaySH , which is written in bash.
')
Main advantages:
- Works with text files
- Can edit templates

Installation



For debian-based distributions: holidaysh.deb
The rest - will have to scatter files with your hands, make a checkout:
$ svn checkout holidaysh.googlecode.com/svn/trunk holidaysh
In holidaysh, delete the DEBIAN folder and scatter files into folders, grant execution rights ( IMPORTANT!: The template files must also have execution rights)

Using



To work with the program, you need to create a ".holidayshrc" file in your home folder with the following text:
HOLIDAYSLIST="~/holidays"
TEMPLATESDIR="~/.holidaysh/templates"


HOLIDAYSLIST - the path to the file with the list of holidays.
TEMPLATESDIR - path to the folder with custom templates - specify, if you wish, to write templates.

By default, the holidays HSH takes from the / etc / holidaysh / holiday-list file, as well as all the files in the /etc/holidaysh/holidays.d/ folder
Templates - in the / etc / holidaysh / templates / folder

Holidays file - a text file with the following information: (divided by the tab characters "\ t")
1) Event Template
Obligatory field.
There are 5 templates in my set: b (birdthday is a birthday), i (info is just an event with information), t (task is a task for the whole day), tt (time task is a task for a specified time).

2) Date
Date, in the format DD / MM / YYYY, a required field.

3) Next are the parameters depending on the selected template.
For example, for a birthday, then there is one field with the name of a person in the genitive case.

Example file with holidays: (separators - tabs)
b 22/05/1990
b 24/02/1984
t 22/05/2010
tt 22/05/2010 10:00


When started without parameters, the program gives holidays to today's date:
$ holidaysh
Testes Testovich's birthday, turns 20
Today you need to write an article on Habré
Today at 10:00 you need to try the task with time

Options:
-d sets the date
$ holidaysh -d 24/02/2010
Experimentych's birthday, turns 26

-p sets additional parameters that are passed directly to the templates. Separated by comma.
For example, -p speech should process all templates and optimize the output for voice alerts.
Now -p speech processes only tt - removes the colon between hours and minutes.

$ holidaysh
Testes Testovich's birthday, turns 20
Today you need to write an article on Habré
Today at 10:00 you need to try the task with time

$ holidaysh -p speech
Testes Testovich's birthday, turns 20
Today you need to write an article on Habré
Today at 10 00 you need to try the task with time

Good luck! If necessary - in the next article I will write how to make templates.

Source: https://habr.com/ru/post/94226/


All Articles