Skip to content

Commit 565b2fe

Browse files
rmnullrmnull
authored andcommitted
deal with extensions when creating new note
1 parent 15189dc commit 565b2fe

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

notes

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,15 @@ new_note() {
117117
if [[ $note_name == "" ]]; then
118118
note_name="$(generate_name)"
119119
fi
120-
mkdir -p "$(dirname "$notes_dir/$note_name")"
121-
open_note "$note_name.$NOTES_EXT"
120+
# mkdir -p "$(dirname "$notes_dir/$note_name")"
121+
122+
mkdir -p "$notes_dir"
123+
ext="${note_name#*.}"
124+
if [[ ext = $note_name ]]; then # lacks extension
125+
open_note "$note_name.$NOTES_EXT"
126+
else
127+
open_note "$note_name"
128+
fi
122129
}
123130

124131
remove_note() {

0 commit comments

Comments
 (0)