ned: add safeguard for when fzf doesn't find a directory or is ctrl-c'd
This commit is contained in:
parent
ec271021a8
commit
4815b0a349
1 changed files with 2 additions and 1 deletions
|
@ -42,7 +42,7 @@ edit() {
|
||||||
SEARCH_TERM="$2"
|
SEARCH_TERM="$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NOTE_PATH="$NOTES_DIR/$(cd "$NOTES_DIR" && fzf -1 -q "$SEARCH_TERM" --layout=reverse --info=inline --height=10%)"
|
NOTE_PATH="$NOTES_DIR/$(cd "$NOTES_DIR" && fzf -1 -q "$SEARCH_TERM" --layout=reverse --info=inline --height=10%)" || exit
|
||||||
|
|
||||||
$EDITOR_CMD "$NOTE_PATH"
|
$EDITOR_CMD "$NOTE_PATH"
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,7 @@ new() {
|
||||||
NOTE_NAME="$(date +'%F').md"
|
NOTE_NAME="$(date +'%F').md"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: use fzf instead of fd + fzf for picking the directory
|
||||||
NOTE_PATH="$(fd -ad 1 "^$2" "$NOTES_DIR")"
|
NOTE_PATH="$(fd -ad 1 "^$2" "$NOTES_DIR")"
|
||||||
# check if there were no results
|
# check if there were no results
|
||||||
if [ -z "$NOTE_PATH" ]; then
|
if [ -z "$NOTE_PATH" ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue