File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
configured_dir=${NOTES_DIRECTORY%/ } # Remove trailing slashes
4
4
notes_dir=" ${configured_dir:- $HOME / notes} "
5
- escaped_notes_dir=$( printf $notes_dir | sed -e ' s/[]\/$*.^|[]/\\&/g' )
5
+ escaped_notes_dir=" $( printf " $notes_dir " | sed -e ' s/[]\/$*.^|[]/\\&/g' ) "
6
6
7
7
# If no $EDITOR, look for `editor` (symlink on debian/ubuntu/etc)
8
8
if [ -z " $EDITOR " ] && type editor & > /dev/null; then
9
9
EDITOR=editor
10
10
fi
11
11
12
12
without_notes_dir () {
13
- cat | sed -e s/^$escaped_notes_dir //g | sed -E " s/^\/+//g"
13
+ cat | sed -e " s/^$escaped_notes_dir //g" | sed -E " s/^\/+//g"
14
14
}
15
15
16
16
find_notes () {
Original file line number Diff line number Diff line change @@ -81,4 +81,14 @@ notes="./notes"
81
81
82
82
assert_success
83
83
assert_output " path with spaces/note.md"
84
- }
84
+ }
85
+
86
+ @test " Should find files inside notes directories with spaces" {
87
+ mkdir " $NOTES_DIRECTORY /path with spaces"
88
+ touch " $NOTES_DIRECTORY /path with spaces/note.md"
89
+
90
+ NOTES_DIRECTORY=" $NOTES_DIRECTORY /path with spaces" run $notes find
91
+
92
+ assert_success
93
+ assert_output " note.md"
94
+ }
Original file line number Diff line number Diff line change @@ -49,3 +49,10 @@ notes="./notes"
49
49
assert_success
50
50
assert_exists " $NOTES_DIRECTORY /subfolder with spaces/note.md"
51
51
}
52
+
53
+ @test " Should create notes within note directories with spaces" {
54
+ NOTES_DIRECTORY=" $NOTES_DIRECTORY /notes with spaces" run $notes new " note"
55
+
56
+ assert_success
57
+ assert_exists " $NOTES_DIRECTORY /notes with spaces/note.md"
58
+ }
You can’t perform that action at this time.
0 commit comments