Skip to content

Commit 0b11d91

Browse files
committed
Make sure new works correctly with spaces
1 parent ec5bbd9 commit 0b11d91

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

notes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ grep_notes() {
4040
}
4141

4242
new_note() {
43-
note_name=$1
44-
mkdir -p $(dirname $notes_dir/$note_name)
45-
open_note $note_name.md
43+
note_name="$*"
44+
mkdir -p $(dirname "$notes_dir/$note_name")
45+
open_note "$note_name.md"
4646
}
4747

4848
open_something() {

test/test-new.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,11 @@ notes="./notes"
2727

2828
assert_success
2929
assert_exists "$NOTES_DIRECTORY/subfolder/note.md"
30+
}
31+
32+
@test "Should create notes with spaces in the name" {
33+
run $notes new "note with spaces"
34+
35+
assert_success
36+
assert_exists "$NOTES_DIRECTORY/note with spaces.md"
3037
}

0 commit comments

Comments
 (0)