Update README, todos and example
This commit is contained in:
parent
14525088f9
commit
3d9c4102b6
4 changed files with 25 additions and 151 deletions
126
README.md
126
README.md
|
|
@ -1,127 +1,3 @@
|
||||||
# today
|
# today
|
||||||
|
|
||||||
## Commands
|
A program for specifying and tracking (recurring) dates and tasks.
|
||||||
|
|
||||||
### The `TASK` command
|
|
||||||
|
|
||||||
```
|
|
||||||
TASK title
|
|
||||||
(DATE annotation)*
|
|
||||||
[FROM annotation]
|
|
||||||
[UNTIL annotation]
|
|
||||||
(DONE annotation)*
|
|
||||||
long description
|
|
||||||
```
|
|
||||||
|
|
||||||
### The `NOTE` command
|
|
||||||
|
|
||||||
```
|
|
||||||
NOTE title
|
|
||||||
(DATE annotation)+
|
|
||||||
[FROM annotation]
|
|
||||||
[UNTIL annotation]
|
|
||||||
(DONE annotation)*
|
|
||||||
long description
|
|
||||||
```
|
|
||||||
|
|
||||||
### The `BIRTHDAY` command
|
|
||||||
|
|
||||||
```
|
|
||||||
BIRTHDAY name
|
|
||||||
BDATE annotation
|
|
||||||
```
|
|
||||||
|
|
||||||
## Annotations
|
|
||||||
|
|
||||||
### The `DATE` annotation
|
|
||||||
|
|
||||||
Most commands allow or require `DATE` annotations. They are roughly structured
|
|
||||||
like `DATE start [-- end]`. The `end` part can only contain time-related
|
|
||||||
information if the `start` specifies a time.
|
|
||||||
|
|
||||||
More specifically, there are three variants of the `DATE` annotation:
|
|
||||||
```
|
|
||||||
DATE date [delta] [time] [-- [date] [delta] [time]] [; delta]
|
|
||||||
DATE weekday [time] [-- [weekday] [delta] [time]]
|
|
||||||
DATE formula [delta] [time] [-- [delta] [time]]
|
|
||||||
```
|
|
||||||
|
|
||||||
In all three cases, the `end` must contain at least one of the optional elements
|
|
||||||
if it is present. Deltas in the `end` may represent fractional days (e. g.
|
|
||||||
`+3h`) as long as they are not immediately followed by a time and the `start`
|
|
||||||
includes a time. Other deltas may only represent whole-day intervals (they may
|
|
||||||
contain sub-day specifiers like `+24h` or `+25h-60m` as long as they sum to a
|
|
||||||
whole-day interval).
|
|
||||||
|
|
||||||
In the case of the `date` variant, a repetition delta can be specified following
|
|
||||||
a semicolon.
|
|
||||||
|
|
||||||
If multiple `DATE` annotations from a single command start on the same date, all
|
|
||||||
except the first are ignored.
|
|
||||||
|
|
||||||
### The `FROM` and `UNTIL` annotations
|
|
||||||
|
|
||||||
Commands that allow `DATE` annotations also allow the `FROM` and `UNTIL`
|
|
||||||
annotations. These can be used to restrict occurrences of entries.
|
|
||||||
|
|
||||||
The `FROM` annotation has the form `FROM date` and only keeps occurences that
|
|
||||||
end at or after the specified date. These occurences may begin before the
|
|
||||||
specified date.
|
|
||||||
|
|
||||||
The `UNTIL` annotation has the form `UNTIL date` and only keeps occurrences that
|
|
||||||
start at or before the specified date. These occurrences may extend past the
|
|
||||||
specified date.
|
|
||||||
|
|
||||||
### The `BDATE` annotations
|
|
||||||
|
|
||||||
This is a very simple date annotation for birthdays. It has the form
|
|
||||||
`BDATE date` where the year may optionally be replaced by a `?`.
|
|
||||||
|
|
||||||
If the year is specified, the person's current age is displayed in the birthday
|
|
||||||
occurrence title.
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
```
|
|
||||||
NOTE Spielerunde
|
|
||||||
DATE sun 22:00 -- 24:00
|
|
||||||
DATE sun 22:00 -- 00:00
|
|
||||||
DATE sun 22:00 -- +2h
|
|
||||||
DATE (wd = sun) 22:00 -- 24:00
|
|
||||||
DATE 2021-11-07 22:00 -- 24:00; +w
|
|
||||||
DATE 2021-11-07 22:00 -- +2h; +w
|
|
||||||
|
|
||||||
NOTE daily
|
|
||||||
DATE *
|
|
||||||
DATE (true)
|
|
||||||
DATE 2021-11-07; +d
|
|
||||||
|
|
||||||
NOTE on weekends
|
|
||||||
DATE (wd = sat | wd = sun)
|
|
||||||
|
|
||||||
NOTE weekends
|
|
||||||
DATE sat -- sun
|
|
||||||
DATE 2021-11-06 -- 2021-11-07; +w
|
|
||||||
DATE 2021-11-06 -- +d; +w
|
|
||||||
DATE (wd = sat) -- +d
|
|
||||||
|
|
||||||
NOTE last of each month
|
|
||||||
DATE (m = 1) -d
|
|
||||||
|
|
||||||
BIRTHDAY Max
|
|
||||||
BDATE 1987-05-14
|
|
||||||
|
|
||||||
BIRTHDAY Martha
|
|
||||||
BDATE ?-09-21
|
|
||||||
|
|
||||||
NOTE Physics lecture
|
|
||||||
DATE wed 14:00 -- 15:30
|
|
||||||
DATE 2021-05-07 14:00 -- 15:30
|
|
||||||
FROM 2021-04-14
|
|
||||||
UNTIL 2021-07-28
|
|
||||||
EXCEPT 2021-05-06
|
|
||||||
This is a description of the event. It might mention further information
|
|
||||||
that doesn't fit into the title.
|
|
||||||
|
|
||||||
It may even contain multiple paragraphs, separated by an arbitrary amount
|
|
||||||
of empty lines, as long as every non-empty line is indented.
|
|
||||||
```
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,30 @@
|
||||||
TASK foo
|
NOTE Physics lecture
|
||||||
|
FROM 2021-04-14
|
||||||
|
UNTIL 2021-07-28
|
||||||
|
DATE wed 14:00 -- 15:30
|
||||||
|
MOVE 2021-05-05 TO 2021-05-07
|
||||||
|
# This is a description of the event. It might mention further information that
|
||||||
|
# doesn't fit into the title.
|
||||||
|
#
|
||||||
|
# It may even contain multiple paragraphs.
|
||||||
|
|
||||||
NOTE daily
|
NOTE Daily
|
||||||
DATE *
|
DATE *
|
||||||
DATE (true)
|
|
||||||
DATE 2021-11-07; +d
|
|
||||||
|
|
||||||
NOTE on weekends
|
NOTE On Saturday and Sunday
|
||||||
DATE (wd = sat | wd = sun)
|
DATE (isWeekend)
|
||||||
|
# or (wd = sat | wd = sun)
|
||||||
|
|
||||||
NOTE weekends
|
NOTE The whole weekend
|
||||||
DATE sat -- sun
|
DATE sat -- sun
|
||||||
DATE 2021-11-06 -- 2021-11-07; +w
|
# or DATE (wd = sat) -- +d
|
||||||
DATE 2021-11-06 -- +d; +w
|
|
||||||
DATE (wd = sat) -- +d
|
|
||||||
|
|
||||||
NOTE last of each month
|
NOTE The last day of each month
|
||||||
DATE (m = 1) -d
|
DATE (D = 1)
|
||||||
|
|
||||||
NOTE Second sunday of each month
|
NOTE The second Sunday of each month
|
||||||
DATE (d = 1) +2sun
|
|
||||||
DATE (wd = sun & mw = 2)
|
DATE (wd = sun & mw = 2)
|
||||||
|
# or DATE (d = 1) +2sun
|
||||||
|
|
||||||
NOTE Easter
|
NOTE Easter
|
||||||
DATE (yd = e)
|
DATE (yd = e)
|
||||||
|
|
@ -53,13 +58,3 @@ BDATE 1987-05-14
|
||||||
|
|
||||||
NOTE Martha
|
NOTE Martha
|
||||||
BDATE ?-09-21
|
BDATE ?-09-21
|
||||||
|
|
||||||
NOTE Physics lecture
|
|
||||||
FROM 2021-04-14
|
|
||||||
UNTIL 2021-07-28
|
|
||||||
DATE wed 14:00 -- 15:30
|
|
||||||
MOVE 2021-05-05 TO 2021-05-07
|
|
||||||
# This is a description of the event. It might mention further information that
|
|
||||||
# doesn't fit into the title.
|
|
||||||
#
|
|
||||||
# It may even contain multiple paragraphs.
|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ pub struct DateSpec {
|
||||||
pub end_delta: Option<Delta>,
|
pub end_delta: Option<Delta>,
|
||||||
pub end_time: Option<Spanned<Time>>,
|
pub end_time: Option<Spanned<Time>>,
|
||||||
pub repeat: Option<Repeat>,
|
pub repeat: Option<Repeat>,
|
||||||
|
// TODO Allow specifying amount of repetitions
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -256,9 +257,11 @@ pub struct BirthdaySpec {
|
||||||
pub enum Statement {
|
pub enum Statement {
|
||||||
Date(Spec),
|
Date(Spec),
|
||||||
BDate(BirthdaySpec),
|
BDate(BirthdaySpec),
|
||||||
|
// TODO Allow specifying delta and repetitions for FROM and UNTIL
|
||||||
From(Option<NaiveDate>),
|
From(Option<NaiveDate>),
|
||||||
Until(Option<NaiveDate>),
|
Until(Option<NaiveDate>),
|
||||||
Except(NaiveDate), // TODO Allow excluding ranges
|
// TODO Allow excluding ranges (maybe with --range syntax?)
|
||||||
|
Except(NaiveDate),
|
||||||
Move {
|
Move {
|
||||||
span: Span,
|
span: Span,
|
||||||
from: NaiveDate,
|
from: NaiveDate,
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ impl fmt::Display for Statement {
|
||||||
|
|
||||||
impl fmt::Display for DoneDate {
|
impl fmt::Display for DoneDate {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
// TODO Convert to Dates and back to remove redundant dates?
|
// TODO Remove redundant dates
|
||||||
match self {
|
match self {
|
||||||
DoneDate::Date { root } => write!(f, "{}", root),
|
DoneDate::Date { root } => write!(f, "{}", root),
|
||||||
DoneDate::DateTime { root, root_time } => write!(f, "{} {}", root, root_time),
|
DoneDate::DateTime { root, root_time } => write!(f, "{} {}", root, root_time),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue