File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ configured_dir=${NOTES_DIRECTORY%/} # Remove trailing slashes
12
12
notes_dir=" ${configured_dir:- $HOME / notes} "
13
13
escaped_notes_dir=" $( printf " $notes_dir " | sed -e ' s/[]\/$*.^|[]/\\&/g' ) "
14
14
15
+ # Make sure the notes directory actually exists, and create it if it doesn't
16
+ if [ ! -d " $notes_dir " ]; then
17
+ mkdir -p " $notes_dir "
18
+ fi
19
+
15
20
# If no $EDITOR, look for `editor` (symlink on debian/ubuntu/etc)
16
21
if [ -z " $EDITOR " ] && type editor & > /dev/null; then
17
22
EDITOR=editor
Original file line number Diff line number Diff line change
1
+ #! ./test/libs/bats/bin/bats
2
+
3
+ load ' libs/bats-support/load'
4
+ load ' libs/bats-assert/load'
5
+ load ' helpers'
6
+
7
+ setup () {
8
+ setupNotesEnv
9
+ }
10
+
11
+ teardown () {
12
+ teardownNotesEnv
13
+ }
14
+
15
+ export EDITOR=touch
16
+ notes=" ./notes"
17
+
18
+ @test " NOTES_DIRECTORY should be created if it doesn't exist" {
19
+ rm -r $NOTES_DIRECTORY
20
+ run $notes new test
21
+ assert_success
22
+ assert_exists " $NOTES_DIRECTORY /test.md"
23
+ }
You can’t perform that action at this time.
0 commit comments