goto functionality
This commit is contained in:
parent
5ebcc4feb6
commit
f025ecd0bb
14
src/main.sh
14
src/main.sh
@ -328,6 +328,7 @@ if [ "${1:-}" = "--help" ]; then
|
|||||||
echo " --help Show this help and exit"
|
echo " --help Show this help and exit"
|
||||||
echo " --new Create new entry"
|
echo " --new Create new entry"
|
||||||
echo " --today Show today's appointments"
|
echo " --today Show today's appointments"
|
||||||
|
echo " --goto Interactively enter date to jump to"
|
||||||
echo " --day <day> Show appointments of specified day"
|
echo " --day <day> Show appointments of specified day"
|
||||||
echo " --date <date> Show week of specified date"
|
echo " --date <date> Show week of specified date"
|
||||||
exit
|
exit
|
||||||
@ -337,6 +338,17 @@ if [ "${1:-}" = "--today" ]; then
|
|||||||
exec $0 --day "today"
|
exec $0 --day "today"
|
||||||
fi
|
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
|
if [ "${1:-}" = "--new" ]; then
|
||||||
collection=$(echo "$COLLECTION_LABELS" | tr ';' '\n' | $FZF --delimiter='=' --with-nth=2 --accept-nth=1)
|
collection=$(echo "$COLLECTION_LABELS" | tr ';' '\n' | $FZF --delimiter='=' --with-nth=2 --accept-nth=1)
|
||||||
fpath=""
|
fpath=""
|
||||||
@ -541,7 +553,6 @@ selection=$(
|
|||||||
--accept-nth=1,2 \
|
--accept-nth=1,2 \
|
||||||
--no-info \
|
--no-info \
|
||||||
--ansi \
|
--ansi \
|
||||||
--no-clear \
|
|
||||||
--no-scrollbar \
|
--no-scrollbar \
|
||||||
--preview-window=up,7,border-bottom \
|
--preview-window=up,7,border-bottom \
|
||||||
--preview="$0 --preview-week {}" \
|
--preview="$0 --preview-week {}" \
|
||||||
@ -554,6 +565,7 @@ selection=$(
|
|||||||
--bind="ctrl-alt-u:become($0 --date '$DISPLAY_DATE_PREV_MONTH')" \
|
--bind="ctrl-alt-u:become($0 --date '$DISPLAY_DATE_PREV_MONTH')" \
|
||||||
--bind="ctrl-alt-d:become($0 --date '$DISPLAY_DATE_NEXT_MONTH')" \
|
--bind="ctrl-alt-d:become($0 --date '$DISPLAY_DATE_NEXT_MONTH')" \
|
||||||
--bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
|
--bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
|
||||||
|
--bind="ctrl-g:become($0 --goto)" \
|
||||||
--bind="ctrl-l:become($0)"
|
--bind="ctrl-l:become($0)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user