Fixed a bug where notes would not be created if the notebook didn't exist.
Added "No notes" message to list function
This commit is contained in:
@@ -31,7 +31,9 @@ function create(){
|
||||
|
||||
# If the note's notebook/section does not exist,
|
||||
# create the appropriate folders.
|
||||
mkdir -p "$NOTES_DIR"/"$(dirname "$FILE")"
|
||||
if [ ! -d "$(dirname $FILE)" ]; then
|
||||
mkdir -p "$(dirname $FILE)"
|
||||
fi
|
||||
|
||||
# Write the standard note header
|
||||
if [ "$ENCRYPTION" == "TRUE" ]; then
|
||||
@@ -159,9 +161,14 @@ function list(){
|
||||
|
||||
if [ ! "$NOTEBOOK" ]; then NOTEBOOK="."; fi
|
||||
cd "$NOTES_DIR" 2>/dev/null || exit 0
|
||||
find "$NOTEBOOK" -type f -name "*$EXT" 2>/dev/null || exit 0 | while read file; do
|
||||
printf "%s\n" "${file%.*}"
|
||||
done
|
||||
NOTES=$(find "$NOTEBOOK" -type f -name "*$EXT" 2>/dev/null)
|
||||
if [ "${NOTES[@]}" ]; then
|
||||
for file in "${NOTES[@]}"; do
|
||||
printf "%s\n" "${file%.*}"
|
||||
done
|
||||
else
|
||||
echo "No notes found."
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user