From f025ecd0bb12009050654ce49ca9a6a11ad0de5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=84min=20Baumeler?= Date: Wed, 11 Jun 2025 10:03:04 +0200 Subject: [PATCH] goto functionality --- src/main.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.sh b/src/main.sh index dc94c4d..2199689 100755 --- a/src/main.sh +++ b/src/main.sh @@ -328,6 +328,7 @@ if [ "${1:-}" = "--help" ]; then echo " --help Show this help and exit" echo " --new Create new entry" echo " --today Show today's appointments" + echo " --goto Interactively enter date to jump to" echo " --day Show appointments of specified day" echo " --date Show week of specified date" exit @@ -337,6 +338,17 @@ if [ "${1:-}" = "--today" ]; then exec $0 --day "today" fi +if [ "${1:-}" = "--goto" ]; then + DISPLAY_DATE="" + while [ -z "$DISPLAY_DATE" ]; do + printf "Enter date you want to jump to, e.g., today + 1 month or 2024-1-14: " >/dev/tty + read -r tmp + if date -d "$tmp"; then + DISPLAY_DATE="$tmp" + fi + done +fi + if [ "${1:-}" = "--new" ]; then collection=$(echo "$COLLECTION_LABELS" | tr ';' '\n' | $FZF --delimiter='=' --with-nth=2 --accept-nth=1) fpath="" @@ -541,7 +553,6 @@ selection=$( --accept-nth=1,2 \ --no-info \ --ansi \ - --no-clear \ --no-scrollbar \ --preview-window=up,7,border-bottom \ --preview="$0 --preview-week {}" \ @@ -554,6 +565,7 @@ selection=$( --bind="ctrl-alt-u:become($0 --date '$DISPLAY_DATE_PREV_MONTH')" \ --bind="ctrl-alt-d:become($0 --date '$DISPLAY_DATE_NEXT_MONTH')" \ --bind="ctrl-s:execute($SYNC_CMD ; printf 'Press to continue.'; read -r tmp)" \ + --bind="ctrl-g:become($0 --goto)" \ --bind="ctrl-l:become($0)" )