Reimplementation of the BSD calendar(1) program in Rust
git clone https://git.8pit.net/ncalendar.git
1## About 2 3This is an implementation of the `calendar(1)` program as available on [many][openbsd calendar] [BSD][freebsd calendar] [variants][netbsd calendar]. 4 5## Status 6 7This is mostly intended as a toy project for experimenting a bit with Rust. 8The implementation is primarily inspired by the [OpenBSD `calendar(1)` implementation][openbsd calendar] and implements most of its feature. 9However, the input format is not intended to be fully compatible with OpenBSD.1011## Features1213* Saner and more strict input format compared to the BSD version14* Re-usable parser for the input format is provided as a Rust library15 * Allows building additional tools on top16 * For example, exporters for other formats17* Lots of great non-features:18 * No locale support19 * No support for Julian or Cyrillic calendars20 * No built-in support for [national holidays][openbsd ostern.c]2122## Installation2324This software can be installed using the following commands:2526 $ cargo install --path .2728This will drop the `ncalendar` binary into `~/.cargo/bin`.29Make sure that directory is in your `$PATH`.3031## Usage3233The `ncalendar(1)` program reads calendar entries from the file `~/.ncalendar/calendar` by default.34The input format for this file is "documented" through [parser combinators][parser combinators wk] in `src/lib/format.rs`.35When invoked, all calendar entries which match a certain time span are written to standard output.36By default, entries for the current and the next day are printed.37The time span can be configured, via the `-B` (backward), `-A` (forward) and `-t` (set different current date) command-line options an.38For example:3940 $ ncalendar -B 3 -A 11 -t 201220224142Will print all calendars in the inclusive range between the 17th December of 2022 and the 31th December.43The program is best invoked from a daily user-level cronjob.4445## Test4647Unit tests can be executed using the following command:4849 $ cargo test505152## License5354This program is free software: you can redistribute it and/or modify it55under the terms of the GNU Affero General Public License as published by56the Free Software Foundation, either version 3 of the License, or (at57your option) any later version.5859This program is distributed in the hope that it will be useful, but60WITHOUT ANY WARRANTY; without even the implied warranty of61MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero62General Public License for more details.6364You should have received a copy of the GNU Affero General Public License65along with this program. If not, see <https://www.gnu.org/licenses/>.6667[openbsd calendar]: https://man.openbsd.org/calendar68[freebsd calendar]: https://www.freebsd.org/cgi/man.cgi?query=calendar69[netbsd calendar]: https://man.netbsd.org/calendar.170[parser combinators wk]: https://en.wikipedia.org/wiki/Parser_combinator71[openbsd ostern.c]: https://github.com/openbsd/src/blob/47f32dc2b6cade03c63e7f98f4f715cb45238c6e/usr.bin/calendar/ostern.c