Skip to content

Commit 658ba00

Browse files
committed
Added abiility to create quicknote in subfolder
1 parent 1275e51 commit 658ba00

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ There are also more complex options available. You can set any configuration pro
9393

9494
### `notes new <note-name>`
9595

96-
Opens your `$EDITOR` of choice for a new note, with the given name. The name can include slashes, if you want to put your note in a subfolder. Leave out the name if you want one to be generated for you (e.g. `quicknote-2016-12-21.md` - format configurable with `$QUICKNOTE_FORMAT`). Shorthand alias also available with `notes n`.
96+
Opens your `$EDITOR` of choice for a new note, with the given name. The name can include slashes, if you want to put your note in a subfolder. Leave out the name if you want one to be generated for you (e.g. `quicknote-2016-12-21.md` - format configurable with `$QUICKNOTE_FORMAT`). If you want to place a quicknote in a subfolder, use a trailing slash: `notes new subfolder/`. Shorthand alias also available with `notes n`.
9797

9898
### `notes find <part-of-a-note-name>`
9999

notes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ new_note() {
118118
if [[ $note_name == "" ]]; then
119119
note_name="$(generate_name)"
120120
fi
121+
122+
if echo "$note_name" | grep "/$" &> /dev/null; then
123+
note_name="${note_name}/$(generate_name)"
124+
fi
125+
121126
mkdir -p "$(dirname "$notes_dir/$note_name")"
122127

123128
open_note "$note_name"

0 commit comments

Comments
 (0)