Compare commits
8 Commits
local
...
3eef1aa8f3
Author | SHA1 | Date | |
---|---|---|---|
3eef1aa8f3 | |||
ff898c84c8 | |||
dc88d5a965 | |||
cdc008e361 | |||
7549acb20c | |||
aee1a1bf24 | |||
4ebcbe36e3 | |||
acc231027b |
@@ -1,4 +1,7 @@
|
|||||||
A [fzf](https://github.com/junegunn/fzf)-based **calendar** application with CalDav support.
|
A [fzf](https://github.com/junegunn/fzf)-based **calendar** application with CalDav support.
|
||||||
|
If you are interested in this, then you may also be interested in the
|
||||||
|
corresponding journaling application
|
||||||
|
[fzf-vjour](https://github.com/baumea/fzf-vjour).
|
||||||
|
|
||||||
Description and Use Case
|
Description and Use Case
|
||||||
------------------------
|
------------------------
|
||||||
@@ -81,10 +84,12 @@ Here is the list of available keybindings:
|
|||||||
| `ctrl-alt-u` | week view | Go back one month |
|
| `ctrl-alt-u` | week view | Go back one month |
|
||||||
| `ctrl-alt-d` | week view | Go forth one month |
|
| `ctrl-alt-d` | week view | Go forth one month |
|
||||||
| `ctrl-s` | week view | Run the synchronization command |
|
| `ctrl-s` | week view | Run the synchronization command |
|
||||||
| `ctrl-l` | week view | Go to current week |
|
| `ctrl-r` | week view | Go to current week |
|
||||||
| `ctrl-g` | week view | Goto date |
|
| `ctrl-g` | week view | Goto date |
|
||||||
| `enter` | day view | Open selected calendar entry in your favorite `$EDITOR` |
|
| `enter` | day view | Open selected calendar entry in your favorite `$EDITOR` |
|
||||||
| `ctrl-n` | day view | Make a new entry |
|
| `ctrl-n` | day view | Make a new entry |
|
||||||
|
| `ctrl-l` | day view | Move to next day |
|
||||||
|
| `ctrl-h` | day view | Move to previous day |
|
||||||
| `esc`, `backspace` or `q` | day view | Go back to week view |
|
| `esc`, `backspace` or `q` | day view | Go back to week view |
|
||||||
| `ctrl-s` | day view | Run the synchronization command |
|
| `ctrl-s` | day view | Run the synchronization command |
|
||||||
| `ctrl-alt-d` | day view | Delete selected entry |
|
| `ctrl-alt-d` | day view | Delete selected entry |
|
||||||
|
@@ -14,7 +14,7 @@ function slice(start, stop, desc) {
|
|||||||
}
|
}
|
||||||
function hrline(hour) {
|
function hrline(hour) {
|
||||||
hour = hour < 10 ? "0"hour : hour
|
hour = hour < 10 ? "0"hour : hour
|
||||||
print hour, "", "", "", FAINT hour ":00 ----------------------" OFF
|
print today, hour, "", "", "", FAINT hour ":00 ----------------------" OFF
|
||||||
}
|
}
|
||||||
function hrlines(start, stop, h, starth, stoph, tmp, i) {
|
function hrlines(start, stop, h, starth, stoph, tmp, i) {
|
||||||
starth = substr(start, 1, 2)
|
starth = substr(start, 1, 2)
|
||||||
@@ -39,11 +39,11 @@ BEGIN {
|
|||||||
OFF = "\033[m"
|
OFF = "\033[m"
|
||||||
OFS = "|"
|
OFS = "|"
|
||||||
}
|
}
|
||||||
$1 == "00:00" && $2 == "00:00" { print $1, $3, $4, $5, allday($6); next }
|
$1 == "00:00" && $2 == "00:00" { print today, $1, $3, $4, $5, allday($6); next }
|
||||||
$1 == "00:00" { print $1, $3, $4, $5, endstoday($2, $6); next }
|
$1 == "00:00" { print today, $1, $3, $4, $5, endstoday($2, $6); next }
|
||||||
$1 ~ /^[0-9]{2}:[0-9]{2}$/ {
|
$1 ~ /^[0-9]{2}:[0-9]{2}$/ {
|
||||||
daystart = hrlines($1, $2, daystart, starth, stoph, tmp, i)
|
daystart = hrlines($1, $2, daystart, starth, stoph, tmp, i)
|
||||||
print $1, $3, $4, $5, slice($1, $2, $6)
|
print today, $1, $3, $4, $5, slice($1, $2, $6)
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
hrlines(dayend":00", 0, daystart, starth, stoph, tmp, i)
|
hrlines(dayend":00", 0, daystart, starth, stoph, tmp, i)
|
||||||
|
@@ -1,17 +1,27 @@
|
|||||||
BEGIN { FS="|"; i=0; dlt = -259200; spw = 604800; }
|
BEGIN { FS="|" }
|
||||||
NR == FNR {
|
NR == FNR {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
from[i] = int(($1 + dlt)/ spw);
|
from_year[i] = $1
|
||||||
|
from_week[i] = $2
|
||||||
getline;
|
getline;
|
||||||
to[i] = int(($1 + dlt) / spw);
|
to_year[i] = $1
|
||||||
|
to_week[i] = $2
|
||||||
next
|
next
|
||||||
} # Load start and end week numbers from first file
|
} # Load start and end week numbers from first file
|
||||||
|
|
||||||
{
|
{
|
||||||
if (from[FNR] > to[FNR])
|
year_i = from_year[FNR]
|
||||||
print "FNR", FNR, ":", from[FNR],"-",to[FNR], " ",$0;
|
week_i = from_week[FNR]
|
||||||
for(i=from[FNR]; i<=to[FNR]; i++) {
|
year_end = to_year[FNR]
|
||||||
week[i] = week[i] " " $5
|
week_end = to_week[FNR]
|
||||||
|
while(year_i <= year_end && (year_i < year_end || week_i <= week_end)) {
|
||||||
|
label = year_i"|"week_i
|
||||||
|
week[label] = week[label] " " $5
|
||||||
|
week_i++
|
||||||
|
if (week_i > 53) {
|
||||||
|
week_ = 1
|
||||||
|
year_i++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END { for (i in week) print i week[i]; }
|
}
|
||||||
|
END { for (label in week) print label week[label]; }
|
||||||
|
@@ -27,10 +27,18 @@ BEGIN {
|
|||||||
desc { desc = desc "\\n" $0; next; }
|
desc { desc = desc "\\n" $0; next; }
|
||||||
{
|
{
|
||||||
from = substr($0, 1, 6) == "::: |>" ? substr($0, 8) : "";
|
from = substr($0, 1, 6) == "::: |>" ? substr($0, 8) : "";
|
||||||
|
if (!from)
|
||||||
|
exit 1
|
||||||
getline
|
getline
|
||||||
to = substr($0, 1, 6) == "::: <|" ? substr($0, 8) : "";
|
to = substr($0, 1, 6) == "::: <|" ? substr($0, 8) : "";
|
||||||
|
if (!to)
|
||||||
|
exit 1
|
||||||
getline
|
getline
|
||||||
|
location = substr($0, 1, 2) == "@ " ? substr($0, 3) : ""
|
||||||
|
if (location) getline
|
||||||
summary = substr($0, 1, 2) == "# " ? substr($0, 3) : ""
|
summary = substr($0, 1, 2) == "# " ? substr($0, 3) : ""
|
||||||
|
if (!summary)
|
||||||
|
exit 1
|
||||||
getline # This line should be empty
|
getline # This line should be empty
|
||||||
getline # First line of description
|
getline # First line of description
|
||||||
desc = $0;
|
desc = $0;
|
||||||
@@ -41,7 +49,7 @@ END {
|
|||||||
# If nanoseconds are not 0, then we assume user enterd "tomorrow" or
|
# If nanoseconds are not 0, then we assume user enterd "tomorrow" or
|
||||||
# something the like, and we make this a date entry, as opposed to a
|
# something the like, and we make this a date entry, as opposed to a
|
||||||
# date-time entry.
|
# date-time entry.
|
||||||
from = from ? from : "now"
|
gsub("\"", "\\\"", from)
|
||||||
cmd = "date -d \"" from "\" +\"%N\"";
|
cmd = "date -d \"" from "\" +\"%N\"";
|
||||||
cmd | getline t
|
cmd | getline t
|
||||||
close(cmd)
|
close(cmd)
|
||||||
@@ -53,10 +61,13 @@ END {
|
|||||||
from_type = "DATE"
|
from_type = "DATE"
|
||||||
cmd = "date -d \"" from "\" +\"%Y%m%d\"";
|
cmd = "date -d \"" from "\" +\"%Y%m%d\"";
|
||||||
}
|
}
|
||||||
cmd | getline from
|
suc = cmd | getline from
|
||||||
close(cmd)
|
close(cmd)
|
||||||
|
if (suc != 1) {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
#
|
#
|
||||||
to = to ? to : "now"
|
gsub("\"", "\\\"", to)
|
||||||
cmd = "date -d \"" to "\" +\"%N\"";
|
cmd = "date -d \"" to "\" +\"%N\"";
|
||||||
cmd | getline t
|
cmd | getline t
|
||||||
close(cmd)
|
close(cmd)
|
||||||
@@ -68,9 +79,13 @@ END {
|
|||||||
to_type = "DATE"
|
to_type = "DATE"
|
||||||
cmd = "date -d \"" to "\" +\"%Y%m%d\"";
|
cmd = "date -d \"" to "\" +\"%Y%m%d\"";
|
||||||
}
|
}
|
||||||
cmd | getline to
|
suc = cmd | getline to
|
||||||
close(cmd)
|
close(cmd)
|
||||||
|
if (suc != 1) {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
escape(summary);
|
escape(summary);
|
||||||
|
escape(location);
|
||||||
escape(desc);
|
escape(desc);
|
||||||
|
|
||||||
# print ical
|
# print ical
|
||||||
@@ -90,6 +105,7 @@ END {
|
|||||||
print "DTEND;VALUE=" to_type ":" to
|
print "DTEND;VALUE=" to_type ":" to
|
||||||
if (summary) print_fold("SUMMARY:", summary, i, s);
|
if (summary) print_fold("SUMMARY:", summary, i, s);
|
||||||
if (desc) print_fold("DESCRIPTION:", desc, i, s);
|
if (desc) print_fold("DESCRIPTION:", desc, i, s);
|
||||||
|
if (location) print_fold("LOCATION:", location, i, s);
|
||||||
print "END:VEVENT"
|
print "END:VEVENT"
|
||||||
print "END:VCALENDAR"
|
print "END:VCALENDAR"
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ ENDFILE {
|
|||||||
# If nanoseconds are not 0, then we assume user enterd "tomorrow" or
|
# If nanoseconds are not 0, then we assume user enterd "tomorrow" or
|
||||||
# something the like, and we make this a date entry, as opposed to a
|
# something the like, and we make this a date entry, as opposed to a
|
||||||
# date-time entry.
|
# date-time entry.
|
||||||
from = from ? from : "now"
|
gsub("\"", "\\\"", from)
|
||||||
cmd = "date -d \"" from "\" +\"%N\"";
|
cmd = "date -d \"" from "\" +\"%N\"";
|
||||||
cmd | getline t
|
cmd | getline t
|
||||||
close(cmd)
|
close(cmd)
|
||||||
@@ -48,10 +48,13 @@ ENDFILE {
|
|||||||
from_type = "DATE"
|
from_type = "DATE"
|
||||||
cmd = "date -d \"" from "\" +\"%Y%m%d\"";
|
cmd = "date -d \"" from "\" +\"%Y%m%d\"";
|
||||||
}
|
}
|
||||||
cmd | getline from
|
suc = cmd | getline from
|
||||||
close(cmd)
|
close(cmd)
|
||||||
|
if (suc != 1) {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
#
|
#
|
||||||
to = to ? to : "now"
|
gsub("\"", "\\\"", to)
|
||||||
cmd = "date -d \"" to "\" +\"%N\"";
|
cmd = "date -d \"" to "\" +\"%N\"";
|
||||||
cmd | getline t
|
cmd | getline t
|
||||||
close(cmd)
|
close(cmd)
|
||||||
@@ -63,20 +66,32 @@ ENDFILE {
|
|||||||
to_type = "DATE"
|
to_type = "DATE"
|
||||||
cmd = "date -d \"" to "\" +\"%Y%m%d\"";
|
cmd = "date -d \"" to "\" +\"%Y%m%d\"";
|
||||||
}
|
}
|
||||||
cmd | getline to
|
suc = cmd | getline to
|
||||||
close(cmd)
|
close(cmd)
|
||||||
|
if (suc != 1) {
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
escape(summary);
|
escape(summary);
|
||||||
|
escape(location);
|
||||||
escape(desc);
|
escape(desc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NR == FNR && desc { desc = desc "\\n" $0; next; }
|
NR == FNR && desc { desc = desc "\\n" $0; next; }
|
||||||
NR == FNR {
|
NR == FNR {
|
||||||
from = substr($0, 1, 6) == "::: |>" ? substr($0, 8) : "";
|
from = substr($0, 1, 6) == "::: |>" ? substr($0, 8) : "";
|
||||||
|
if (!from)
|
||||||
|
exit 1
|
||||||
getline
|
getline
|
||||||
to = substr($0, 1, 6) == "::: <|" ? substr($0, 8) : "";
|
to = substr($0, 1, 6) == "::: <|" ? substr($0, 8) : "";
|
||||||
|
if (!to)
|
||||||
|
exit 1
|
||||||
getline
|
getline
|
||||||
|
location = substr($0, 1, 2) == "@ " ? substr($0, 3) : ""
|
||||||
|
if (location) getline
|
||||||
summary = substr($0, 1, 2) == "# " ? substr($0, 3) : ""
|
summary = substr($0, 1, 2) == "# " ? substr($0, 3) : ""
|
||||||
|
if (!summary)
|
||||||
|
exit 1
|
||||||
getline # This line should be empty
|
getline # This line should be empty
|
||||||
getline # First line of description
|
getline # First line of description
|
||||||
desc = $0;
|
desc = $0;
|
||||||
@@ -86,7 +101,7 @@ NR == FNR {
|
|||||||
/^BEGIN:VEVENT$/ { inside = 1; print; next }
|
/^BEGIN:VEVENT$/ { inside = 1; print; next }
|
||||||
/^X-ALT-DESC/ && inside { next } # drop this alternative description
|
/^X-ALT-DESC/ && inside { next } # drop this alternative description
|
||||||
/^ / && inside { next } # drop this folded line (the only content with folded lines will be updated)
|
/^ / && inside { next } # drop this folded line (the only content with folded lines will be updated)
|
||||||
/^(DTSTART|DTEND|SUMMARY|CATEGORIES|DESCRIPTION|LAST-MODIFIED)/ && inside { next } # skip for now, we will write updated fields at the end
|
/^(DTSTART|DTEND|SUMMARY|LOCATION|CATEGORIES|DESCRIPTION|LAST-MODIFIED)/ && inside { next } # skip for now, we will write updated fields at the end
|
||||||
/^SEQUENCE/ && inside { seq = $2; next } # store sequence number and skip
|
/^SEQUENCE/ && inside { seq = $2; next } # store sequence number and skip
|
||||||
/^END:VEVENT$/ {
|
/^END:VEVENT$/ {
|
||||||
seq = seq ? seq + 1 : 1
|
seq = seq ? seq + 1 : 1
|
||||||
@@ -96,6 +111,7 @@ NR == FNR {
|
|||||||
print "DTEND;VALUE=" to_type ":" to
|
print "DTEND;VALUE=" to_type ":" to
|
||||||
print_fold("SUMMARY:", summary, i, s)
|
print_fold("SUMMARY:", summary, i, s)
|
||||||
print_fold("DESCRIPTION:", desc, i, s)
|
print_fold("DESCRIPTION:", desc, i, s)
|
||||||
|
print_fold("LOCATION:", location, i, s)
|
||||||
inside = ""
|
inside = ""
|
||||||
}
|
}
|
||||||
{ print }
|
{ print }
|
||||||
|
1216
src/main.sh
1216
src/main.sh
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user