From a45cf07e92b58f29aa88413a30d921edba48872f Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Mon, 10 Dec 2018 16:55:27 +0100 Subject: Update readme and usage --- Cargo.toml | 5 +++++ README.md | 16 +++++++++++++++- src/main.rs | 9 ++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 551bb3e..565faa0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,11 @@ version = "0.1.0" authors = ["meskio "] license = "GPL-3.0-or-later" description = "Display calendar .ics in command line" +readme = "README.md" +homepage = "https://gitlab.com/meskio/almanac" +repository = "https://gitlab.com/meskio/almanac" +documentation = "https://docs.rs/almanac/" +keywords = ["calendar", "ics", "ical", "terminal", "console"] [dependencies] chrono = "0.4" diff --git a/README.md b/README.md index 45ed09e..c8ee994 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # Almanac -Simple .ics parser to print the following events on the command line. +Simple .ics parser to pretty print the events on the terminal. + +## Usage + +``` +$ almanac week personal.ics other.ics + +Mon Dec 10 2018 + 17:00-18:00 event 1 + +Wed Dec 12 2018 + ----------- all day event + description + 19:00-20:00 nother event +``` diff --git a/src/main.rs b/src/main.rs index 03eab2e..beca8d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,14 @@ use almanac::Event; fn main() { let mut args = env::args().skip(1); - let (first, last) = period(&args.next().unwrap()); + let period_arg = match args.next() { + Some(arg) => arg, + None => { + println!("Usage: almanac [day|week|month] ics [ics ...]"); + return; + } + }; + let (first, last) = period(&period_arg); let calendars: Vec<_> = args.map(|arg| ics_calendar(&arg)).collect(); let events = calendars -- cgit v1.2.3