Compare commits
	
		
			6 Commits
		
	
	
		
			local
			...
			dc88d5a965
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| dc88d5a965 | |||
| cdc008e361 | |||
| 7549acb20c | |||
| aee1a1bf24 | |||
| 4ebcbe36e3 | |||
| acc231027b | 
@@ -1,4 +1,7 @@
 | 
			
		||||
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
 | 
			
		||||
------------------------
 | 
			
		||||
@@ -81,10 +84,12 @@ Here is the list of available keybindings:
 | 
			
		||||
| `ctrl-alt-u` | week view | Go back one month |
 | 
			
		||||
| `ctrl-alt-d` | week view | Go forth one month |
 | 
			
		||||
| `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 |
 | 
			
		||||
| `enter` | day view | Open selected  calendar entry in your favorite `$EDITOR` |
 | 
			
		||||
| `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 |
 | 
			
		||||
| `ctrl-s` | day view | Run the synchronization command |
 | 
			
		||||
| `ctrl-alt-d` | day view | Delete selected entry |
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ function slice(start, stop, desc) {
 | 
			
		||||
}
 | 
			
		||||
function hrline(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) {
 | 
			
		||||
  starth = substr(start, 1, 2)
 | 
			
		||||
@@ -39,11 +39,11 @@ BEGIN {
 | 
			
		||||
  OFF = "\033[m"
 | 
			
		||||
  OFS = "|"
 | 
			
		||||
}
 | 
			
		||||
$1 == "00:00" && $2 == "00:00" { print $1, $3, $4, $5, allday($6);        next }
 | 
			
		||||
$1 == "00:00"                  { print $1, $3, $4, $5, endstoday($2, $6); next }
 | 
			
		||||
$1 == "00:00" && $2 == "00:00" { print today, $1, $3, $4, $5, allday($6);        next }
 | 
			
		||||
$1 == "00:00"                  { print today, $1, $3, $4, $5, endstoday($2, $6); next }
 | 
			
		||||
$1 ~ /^[0-9]{2}:[0-9]{2}$/     {
 | 
			
		||||
  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 {
 | 
			
		||||
  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 {
 | 
			
		||||
  i = i + 1;
 | 
			
		||||
  from[i] = int(($1 + dlt)/ spw);
 | 
			
		||||
  from_year[i] = $1
 | 
			
		||||
  from_week[i] = $2
 | 
			
		||||
  getline;
 | 
			
		||||
  to[i] = int(($1 + dlt) / spw);
 | 
			
		||||
  to_year[i] = $1
 | 
			
		||||
  to_week[i] = $2
 | 
			
		||||
  next
 | 
			
		||||
} # Load start and end week numbers from first file
 | 
			
		||||
 | 
			
		||||
{ 
 | 
			
		||||
  if (from[FNR] > to[FNR])
 | 
			
		||||
    print "FNR", FNR, ":", from[FNR],"-",to[FNR], "    ",$0;
 | 
			
		||||
  for(i=from[FNR]; i<=to[FNR]; i++) {
 | 
			
		||||
    week[i] = week[i] " " $5
 | 
			
		||||
  year_i = from_year[FNR]
 | 
			
		||||
  week_i = from_week[FNR]
 | 
			
		||||
  year_end = to_year[FNR]
 | 
			
		||||
  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,16 @@ BEGIN {
 | 
			
		||||
desc { desc = desc "\\n" $0; next; }
 | 
			
		||||
{
 | 
			
		||||
  from = substr($0, 1, 6) == "::: |>" ? substr($0, 8) : "";
 | 
			
		||||
  if (!from)
 | 
			
		||||
    exit 1
 | 
			
		||||
  getline
 | 
			
		||||
  to = substr($0, 1, 6) == "::: <|" ? substr($0, 8) : "";
 | 
			
		||||
  if (!to)
 | 
			
		||||
    exit 1
 | 
			
		||||
  getline
 | 
			
		||||
  summary = substr($0, 1, 2) == "# " ? substr($0, 3) : ""
 | 
			
		||||
  if (!summary)
 | 
			
		||||
    exit 1
 | 
			
		||||
  getline # This line should be empty
 | 
			
		||||
  getline # First line of description
 | 
			
		||||
  desc = $0;
 | 
			
		||||
@@ -41,7 +47,7 @@ END {
 | 
			
		||||
  # 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
 | 
			
		||||
  # date-time entry.
 | 
			
		||||
  from = from ? from : "now"
 | 
			
		||||
  gsub("\"", "\\\"", from)
 | 
			
		||||
  cmd = "date -d \"" from "\" +\"%N\"";
 | 
			
		||||
  cmd | getline t
 | 
			
		||||
  close(cmd)
 | 
			
		||||
@@ -53,10 +59,13 @@ END {
 | 
			
		||||
    from_type = "DATE"
 | 
			
		||||
    cmd = "date -d \"" from "\" +\"%Y%m%d\"";
 | 
			
		||||
  }
 | 
			
		||||
  cmd | getline from
 | 
			
		||||
  suc = cmd | getline from
 | 
			
		||||
  close(cmd)
 | 
			
		||||
  if (suc != 1) {
 | 
			
		||||
    exit 1
 | 
			
		||||
  }
 | 
			
		||||
  #
 | 
			
		||||
  to = to ? to : "now"
 | 
			
		||||
  gsub("\"", "\\\"", to)
 | 
			
		||||
  cmd = "date -d \"" to "\" +\"%N\"";
 | 
			
		||||
  cmd | getline t
 | 
			
		||||
  close(cmd)
 | 
			
		||||
@@ -68,8 +77,11 @@ END {
 | 
			
		||||
    to_type = "DATE"
 | 
			
		||||
    cmd = "date -d \"" to "\" +\"%Y%m%d\"";
 | 
			
		||||
  }
 | 
			
		||||
  cmd | getline to
 | 
			
		||||
  suc = cmd | getline to
 | 
			
		||||
  close(cmd)
 | 
			
		||||
  if (suc != 1) {
 | 
			
		||||
    exit 1
 | 
			
		||||
  }
 | 
			
		||||
  escape(summary);
 | 
			
		||||
  escape(desc);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ ENDFILE {
 | 
			
		||||
    # 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
 | 
			
		||||
    # date-time entry.
 | 
			
		||||
    from = from ? from : "now"
 | 
			
		||||
    gsub("\"", "\\\"", from)
 | 
			
		||||
    cmd = "date -d \"" from "\" +\"%N\"";
 | 
			
		||||
    cmd | getline t
 | 
			
		||||
    close(cmd)
 | 
			
		||||
@@ -48,10 +48,13 @@ ENDFILE {
 | 
			
		||||
      from_type = "DATE"
 | 
			
		||||
      cmd = "date -d \"" from "\" +\"%Y%m%d\"";
 | 
			
		||||
    }
 | 
			
		||||
    cmd | getline from
 | 
			
		||||
    suc = cmd | getline from
 | 
			
		||||
    close(cmd)
 | 
			
		||||
    if (suc != 1) {
 | 
			
		||||
      exit 1
 | 
			
		||||
    }
 | 
			
		||||
    #
 | 
			
		||||
    to = to ? to : "now"
 | 
			
		||||
    gsub("\"", "\\\"", to)
 | 
			
		||||
    cmd = "date -d \"" to "\" +\"%N\"";
 | 
			
		||||
    cmd | getline t
 | 
			
		||||
    close(cmd)
 | 
			
		||||
@@ -63,20 +66,29 @@ ENDFILE {
 | 
			
		||||
      to_type = "DATE"
 | 
			
		||||
      cmd = "date -d \"" to "\" +\"%Y%m%d\"";
 | 
			
		||||
    }
 | 
			
		||||
    cmd | getline to
 | 
			
		||||
    suc = cmd | getline to
 | 
			
		||||
    close(cmd)
 | 
			
		||||
    if (suc != 1) {
 | 
			
		||||
      exit 1
 | 
			
		||||
    }
 | 
			
		||||
    escape(summary);
 | 
			
		||||
    escape(desc);
 | 
			
		||||
  }
 | 
			
		||||
  escape(summary);
 | 
			
		||||
  escape(desc);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
NR == FNR && desc { desc = desc "\\n" $0; next; }
 | 
			
		||||
NR == FNR {
 | 
			
		||||
  from = substr($0, 1, 6) == "::: |>" ? substr($0, 8) : "";
 | 
			
		||||
  if (!from)
 | 
			
		||||
    exit 1
 | 
			
		||||
  getline
 | 
			
		||||
  to = substr($0, 1, 6) == "::: <|" ? substr($0, 8) : "";
 | 
			
		||||
  if (!to)
 | 
			
		||||
    exit 1
 | 
			
		||||
  getline
 | 
			
		||||
  summary = substr($0, 1, 2) == "# " ? substr($0, 3) : ""
 | 
			
		||||
  if (!summary)
 | 
			
		||||
    exit 1
 | 
			
		||||
  getline # This line should be empty
 | 
			
		||||
  getline # First line of description
 | 
			
		||||
  desc = $0;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										88
									
								
								src/main.sh
									
									
									
									
									
								
							
							
						
						
									
										88
									
								
								src/main.sh
									
									
									
									
									
								
							@@ -144,15 +144,14 @@ __load_approx_data() {
 | 
			
		||||
__load_weeks() {
 | 
			
		||||
  dates=$(awk -F'|' '{ print $2; print $3 }' "$APPROX_DATA_FILE")
 | 
			
		||||
  file_dates=$(mktemp)
 | 
			
		||||
  echo "$dates" | date --file="/dev/stdin" +"%s" >"$file_dates"
 | 
			
		||||
  echo "$dates" | date --file="/dev/stdin" +"%G|%V" >"$file_dates"
 | 
			
		||||
  awk "$AWK_MERGE" "$file_dates" "$APPROX_DATA_FILE"
 | 
			
		||||
  rm "$file_dates"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__show_day() {
 | 
			
		||||
  weeknr=$(date -d "$DISPLAY_DATE" +"%s")
 | 
			
		||||
  weeknr=$(((weeknr - 259200) / 604800)) # shift, because epoch origin is a Thursday
 | 
			
		||||
  files=$(grep "^$weeknr " "$WEEKLY_DATA_FILE" | cut -d " " -f 2-)
 | 
			
		||||
  weeknr=$(date -d "$DISPLAY_DATE" +"%G.%V")
 | 
			
		||||
  files=$(grep "^$weeknr\ " "$WEEKLY_DATA_FILE" | cut -d " " -f 2-)
 | 
			
		||||
  # Find relevant files in list of week files
 | 
			
		||||
  sef=$({
 | 
			
		||||
    set -- $files
 | 
			
		||||
@@ -163,8 +162,8 @@ __show_day() {
 | 
			
		||||
        "$AWK_PARSE" "$file"
 | 
			
		||||
    done
 | 
			
		||||
  })
 | 
			
		||||
  today=$(date -d "$DISPLAY_DATE" +"%D")
 | 
			
		||||
  if [ -n "$sef" ]; then
 | 
			
		||||
    today=$(date -d "$DISPLAY_DATE" +"%D")
 | 
			
		||||
    sef=$(echo "$sef" | while IFS= read -r line; do
 | 
			
		||||
      set -- $line
 | 
			
		||||
      starttime="$1"
 | 
			
		||||
@@ -195,13 +194,12 @@ __show_day() {
 | 
			
		||||
      echo "$s|$e|$starttime|$endtime|$fpath|$description"
 | 
			
		||||
    done)
 | 
			
		||||
  fi
 | 
			
		||||
  echo "$sef" | sort -n | awk -v daystart="$DAY_START" -v dayend="$DAY_END" "$AWK_DAYVIEW"
 | 
			
		||||
  echo "$sef" | sort -n | awk -v today="$today" -v daystart="$DAY_START" -v dayend="$DAY_END" "$AWK_DAYVIEW"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__list() {
 | 
			
		||||
  weeknr=$(date -d "$DISPLAY_DATE" +"%s")
 | 
			
		||||
  weeknr=$(((weeknr - 259200) / 604800)) # shift, because epoch origin is a Thursday
 | 
			
		||||
  files=$(grep "^$weeknr " "$WEEKLY_DATA_FILE" | cut -d " " -f 2-)
 | 
			
		||||
  weeknr=$(date -d "$DISPLAY_DATE" +"%G.%V")
 | 
			
		||||
  files=$(grep "^$weeknr\ " "$WEEKLY_DATA_FILE" | cut -d " " -f 2-)
 | 
			
		||||
  dayofweek=$(date -d "$DISPLAY_DATE" +"%u")
 | 
			
		||||
  delta=$((1 - dayofweek))
 | 
			
		||||
  startofweek=$(date -d "$DISPLAY_DATE -$delta days" +"%D")
 | 
			
		||||
@@ -298,19 +296,24 @@ __edit() {
 | 
			
		||||
  # Update only if changes are detected
 | 
			
		||||
  if [ "$checksum" != "$(cksum "$filetmp")" ]; then
 | 
			
		||||
    filenew="$filetmp.ics"
 | 
			
		||||
    awk "$AWK_UPDATE" "$filetmp" "$fpath" >"$filenew"
 | 
			
		||||
    mv "$filenew" "$fpath"
 | 
			
		||||
    __refresh_data
 | 
			
		||||
    if awk "$AWK_UPDATE" "$filetmp" "$fpath" >"$filenew"; then
 | 
			
		||||
      mv "$filenew" "$fpath"
 | 
			
		||||
      __refresh_data
 | 
			
		||||
    else
 | 
			
		||||
      rm -f "$filenew"
 | 
			
		||||
      err "Failed to edit entry. Press <enter> to continue."
 | 
			
		||||
      read -r tmp
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
  rm "$filetmp"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
__refresh_data() {
 | 
			
		||||
  if [ -n "${APPROX_DATA_FILE:-}" ]; then
 | 
			
		||||
    rm "$APPROX_DATA_FILE"
 | 
			
		||||
    rm -f "$APPROX_DATA_FILE"
 | 
			
		||||
  fi
 | 
			
		||||
  if [ -n "${WEEKLY_DATA_FILE:-}" ]; then
 | 
			
		||||
    rm "$WEEKLY_DATA_FILE"
 | 
			
		||||
    rm -f "$WEEKLY_DATA_FILE"
 | 
			
		||||
  fi
 | 
			
		||||
  APPROX_DATA_FILE=$(mktemp)
 | 
			
		||||
  __load_approx_data >"$APPROX_DATA_FILE"
 | 
			
		||||
@@ -380,11 +383,18 @@ if [ "${1:-}" = "--new" ]; then
 | 
			
		||||
  # Update only if changes are detected
 | 
			
		||||
  if [ "$checksum" != "$(cksum "$filetmp")" ]; then
 | 
			
		||||
    filenew="$filetmp.ics"
 | 
			
		||||
    awk -v uid="$uuid" "$AWK_NEW" "$filetmp" >"$filenew"
 | 
			
		||||
    mv "$filenew" "$fpath"
 | 
			
		||||
    __refresh_data
 | 
			
		||||
    if awk -v uid="$uuid" "$AWK_NEW" "$filetmp" >"$filenew"; then
 | 
			
		||||
      mv "$filenew" "$fpath"
 | 
			
		||||
      __refresh_data
 | 
			
		||||
      start=$(awk -v field="DTSTART" "$AWK_GET" "$fpath" | grep -o '[0-9]\{8\}')
 | 
			
		||||
    else
 | 
			
		||||
      rm -f "$filenew"
 | 
			
		||||
      err "Failed to create new entry. Press <enter> to continue."
 | 
			
		||||
      read -r tmp
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
  rm "$filetmp"
 | 
			
		||||
  set -- "--day" "$start"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -z "${APPROX_DATA_FILE:-}" ]; then
 | 
			
		||||
@@ -403,23 +413,27 @@ if [ "${1:-}" = "--day" ]; then
 | 
			
		||||
        --no-input \
 | 
			
		||||
        --margin='20%,5%' \
 | 
			
		||||
        --border='double' \
 | 
			
		||||
        --border-label="🗓️ $(date -d "$DISPLAY_DATE" +"%A %e %B %Y")" \
 | 
			
		||||
        --color=label:bold:green \
 | 
			
		||||
        --border-label-pos=3 \
 | 
			
		||||
        --cycle \
 | 
			
		||||
        --delimiter='|' \
 | 
			
		||||
        --with-nth='{5}' \
 | 
			
		||||
        --accept-nth='1,2,3,4' \
 | 
			
		||||
        --with-nth='{6}' \
 | 
			
		||||
        --accept-nth='2,3,4,5' \
 | 
			
		||||
        --preview="$0 --preview {}" \
 | 
			
		||||
        --expect="ctrl-n,esc,backspace,q" \
 | 
			
		||||
        --bind='load:transform(echo change-border-label:🗓️ $(date -d {1} +"%A %e %B %Y"))+transform(echo {} | grep \|\| || echo show-preview)' \
 | 
			
		||||
        --bind='start:hide-preview' \
 | 
			
		||||
        --bind="ctrl-r:reload:$0 --show-day {1}" \
 | 
			
		||||
        --bind='ctrl-j:down+hide-preview+transform:echo {} | grep \|\| || echo show-preview' \
 | 
			
		||||
        --bind='ctrl-k:up+hide-preview+transform:echo {} | grep \|\| || echo show-preview' \
 | 
			
		||||
        --bind="ctrl-l:hide-preview+reload:$0 --show-day {1} '+1 day'" \
 | 
			
		||||
        --bind="ctrl-h:hide-preview+reload:$0 --show-day {1} '-1 day'" \
 | 
			
		||||
        --bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
 | 
			
		||||
        --bind="ctrl-alt-d:become($0 --delete {})" \
 | 
			
		||||
        --bind="j:preview-down" \
 | 
			
		||||
        --bind="k:preview-down" \
 | 
			
		||||
        --bind="w:toggle-preview-wrap"
 | 
			
		||||
    #--bind="ctrl-u:unbind(load)+reload:$0 --list {2} '-1 week'" \
 | 
			
		||||
  )
 | 
			
		||||
  key=$(echo "$selection" | head -1)
 | 
			
		||||
  line=$(echo "$selection" | tail -1)
 | 
			
		||||
@@ -446,10 +460,10 @@ if [ "${1:-}" = "--date" ]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "${1:-}" = "--preview" ]; then
 | 
			
		||||
  hour=$(echo "$2" | cut -d '|' -f 1)
 | 
			
		||||
  start=$(echo "$2" | cut -d '|' -f 2)
 | 
			
		||||
  end=$(echo "$2" | cut -d '|' -f 3)
 | 
			
		||||
  fpath=$(echo "$2" | cut -d '|' -f 4 | sed "s/ /|/g")
 | 
			
		||||
  hour=$(echo "$2" | cut -d '|' -f 2)
 | 
			
		||||
  start=$(echo "$2" | cut -d '|' -f 3)
 | 
			
		||||
  end=$(echo "$2" | cut -d '|' -f 4)
 | 
			
		||||
  fpath=$(echo "$2" | cut -d '|' -f 5 | sed "s/ /|/g")
 | 
			
		||||
  if [ -n "$hour" ] && [ -n "$fpath" ]; then
 | 
			
		||||
    fpath="$ROOT/$fpath"
 | 
			
		||||
    start=$(__canonical_datetime "$start" "%a ")
 | 
			
		||||
@@ -463,8 +477,8 @@ if [ "${1:-}" = "--preview" ]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
month_previous() {
 | 
			
		||||
  month="$1"
 | 
			
		||||
  year="$2"
 | 
			
		||||
  month=$(echo "$1" | sed 's/^0//')
 | 
			
		||||
  year=$(echo "$2" | sed 's/^0//')
 | 
			
		||||
  if [ "$month" -eq 1 ]; then
 | 
			
		||||
    month=12
 | 
			
		||||
    year=$((year - 1))
 | 
			
		||||
@@ -475,8 +489,8 @@ month_previous() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
month_next() {
 | 
			
		||||
  month="$1"
 | 
			
		||||
  year="$2"
 | 
			
		||||
  month=$(echo "$1" | sed 's/^0//')
 | 
			
		||||
  year=$(echo "$2" | sed 's/^0//')
 | 
			
		||||
  if [ "$month" -eq 12 ]; then
 | 
			
		||||
    month=1
 | 
			
		||||
    year=$((year + 1))
 | 
			
		||||
@@ -548,7 +562,7 @@ if [ "${1:-}" = "--preview-week" ]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "${1:-}" = "--delete" ]; then
 | 
			
		||||
  fpath=$(echo "$2" | cut -d '|' -f 4 | sed "s/ /|/g")
 | 
			
		||||
  fpath=$(echo "$2" | cut -d '|' -f 5 | sed "s/ /|/g")
 | 
			
		||||
  if [ -n "$fpath" ]; then
 | 
			
		||||
    fpath="$ROOT/$fpath"
 | 
			
		||||
    summary=$(awk -v field="SUMMARY" "$AWK_GET" "$fpath")
 | 
			
		||||
@@ -582,6 +596,14 @@ DISPLAY_DATE=${DISPLAY_DATE:-today}
 | 
			
		||||
DISPLAY_DATE=$(date -d "$DISPLAY_DATE" +"%D")
 | 
			
		||||
DISPLAY_POS=$((8 - $(date -d "$DISPLAY_DATE" +"%u")))
 | 
			
		||||
 | 
			
		||||
if [ "${1:-}" = "--show-day" ]; then
 | 
			
		||||
  shift
 | 
			
		||||
  DISPLAY_DATE=${*:-today}
 | 
			
		||||
  DISPLAY_POS=$((8 - $(date -d "$DISPLAY_DATE" +"%u")))
 | 
			
		||||
  __show_day
 | 
			
		||||
  exit
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "${1:-}" = "--list" ]; then
 | 
			
		||||
  shift
 | 
			
		||||
  DISPLAY_DATE=${*:-today}
 | 
			
		||||
@@ -608,13 +630,13 @@ selection=$(
 | 
			
		||||
      --preview-window=up,7,border-bottom \
 | 
			
		||||
      --preview="$0 --preview-week {}" \
 | 
			
		||||
      --expect="ctrl-n" \
 | 
			
		||||
      --bind="ctrl-j:transform:[ \$FZF_POS -le 1 ] &&
 | 
			
		||||
      --bind="ctrl-j:transform:([ {1} = \"+\" ] && [ \$FZF_POS -le 1 ]) &&
 | 
			
		||||
      echo unbind\(load\)+reload:$0 --list {2} '+1 day'||
 | 
			
		||||
      echo down" \
 | 
			
		||||
      --bind="ctrl-k:transform:[ \$FZF_POS -ge 7 ] &&
 | 
			
		||||
      --bind="ctrl-k:transform:([ {1} = \"+\" ] && [ \$FZF_POS -ge 7 ]) &&
 | 
			
		||||
      echo unbind\(load\)+reload:$0 --list {2} '-1 day'||
 | 
			
		||||
      echo up" \
 | 
			
		||||
      --bind="change:reload($0 --all)+hide-preview" \
 | 
			
		||||
      --bind="change:unbind(load)+reload($0 --all)+hide-preview" \
 | 
			
		||||
      --bind="backward-eof:rebind(load)+reload($0 --list)+show-preview" \
 | 
			
		||||
      --bind="load:pos($DISPLAY_POS)" \
 | 
			
		||||
      --bind="ctrl-u:unbind(load)+reload:$0 --list {2} '-1 week'" \
 | 
			
		||||
@@ -623,7 +645,7 @@ selection=$(
 | 
			
		||||
      --bind="ctrl-alt-d:unbind(load)+reload:$0 --list {2} '+1 month'" \
 | 
			
		||||
      --bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
 | 
			
		||||
      --bind="ctrl-g:become($0 --goto)" \
 | 
			
		||||
      --bind="ctrl-l:rebind(load)+reload:$0 --list"
 | 
			
		||||
      --bind="ctrl-r:rebind(load)+reload:$0 --list"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
key=$(echo "$selection" | head -1)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user