Edward-Ji / CalD

An Alpine calendar daemon with a CLI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cald

Docker Image CI Run Test CI

A calendar daemon with command line interface.

Functionality details

Run calendar daemon with python daemon.py [<database path>].

If the optional database path is supplied, it is used by both the daemon and calendar command to store all events.

Run calendar command with python calendar.py <action> [<option>] [<arguments>].

There are four available actions detailed below:

GET

Retrieves events from calendar database using the specified criteria.

python calendar.py GET DATE <date>

All dates here and below assume the format "dd-mm-yyyy".

python calendar.py GET INTERVAL <start date> <end date>

The interval includes both start date and end date.

python calendar.py GET NAME <name>

All event names here and below must match exactly and completely.

The output is in the following format with each event on a new line:

<date> : <name> : <description>

ADD

Add as event with specified date and name to the database.

python calendar.py ADD <date> <name> [<desc>]

UPD

Update all events matching the specified date and name with the new name and the optional new description. If a new description is not specified, the old description is still discarded.

python calendar.py UPD <date> <old name> <new name> [<new description]

DEL

Delete all events matching the specified date and name.

python calendar.py DEL <date> <name>

Testing

Tests can only be run from the repository root. You can run them individually by specifying their path or test/run_all will run all tests automatically.

Install

Build Manually

This project is available as an Alpine Linux build.

All the files needed to build the package is included in the build directory. To build the package yourself, execute the following commands in an Alpine Linux machine from the repository root. If you haven't setup your system and account for abuild, follow the Alpine wiki.

cd build
abuild checksum && abuild -r

The package will be generated in the default packages directory usually ~/packages/cald.

Assuming all the configurations are default, install the package using

sudo apk add --repository /home/$USER/packages/cald cald

After installing the package, the daemon will automatically run upon start up with OpenRC service. A shortcut command calendar is available in place of python3 calendar.py. For example, you can execute the following at command line.

calendar ADD 15-10-2021 "some event" "this will be amazing!"

You can uninstall at anytime with sudo apk del cald. The cald daemon will be automatically stopped and removed from OpenRC.

Virtualization with Docker

If you lack the means to run an Alpine Linux virtual machine, you can use the Docker to run this package in a container. Do note that OpenRC doesn't fully function in a container, so installation on a virtual machine remains the better option. In this project, OpenRC is manually boot up using Docker entry point and volume option.

Use the following commands to download the image from Docker Hub.

docker pull edwardji/cald:main

Or if you prefer building the Docker image yourself, use the following commands.

docker build . --file docker/Dockerfile --tag cald

Then, run the container using the image with

docker run -ti -v /sys/fs/cgroup --name cald_runner cald sh

About

An Alpine calendar daemon with a CLI.


Languages

Language:Python 51.5%Language:Shell 44.4%Language:Dockerfile 4.0%