diff options
author | Ruben Pollan | 2018-12-10 16:55:27 +0100 |
---|---|---|
committer | Ruben Pollan | 2018-12-10 16:55:27 +0100 |
commit | a45cf07e92b58f29aa88413a30d921edba48872f (patch) | |
tree | e2b80f0bcfabafa98642d59c59aba2718b9b0725 | |
parent | fe1fab184fac5beb1bc222ff46bcd6a32f20990d (diff) |
Update readme and usage
-rw-r--r-- | Cargo.toml | 5 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | src/main.rs | 9 |
3 files changed, 28 insertions, 2 deletions
@@ -4,6 +4,11 @@ version = "0.1.0" authors = ["meskio <meskio@sindominio.net>"] 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" @@ -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 |