File tree Expand file tree Collapse file tree 3 files changed +16
-15
lines changed
Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ if [ -z "$EDITOR" ] && type editor &>/dev/null; then
2020fi
2121
2222without_notes_dir () {
23- cat | sed -e " s/$escaped_notes_dir //g" | sed -E " s/^\/+//g"
23+ cat | sed -e " s/^ $escaped_notes_dir //g" | sed -E " s/^\/+//g"
2424}
2525
2626ls_notes () {
@@ -91,7 +91,8 @@ grep_notes() {
9191 IFS=$' \n '
9292 for result in $matches ; do
9393 len=${# result}
94- grep_output+=" $( echo ${result} ) \n"
94+ result=$( echo $result | cut -d' /' -f2-)
95+ grep_output+=" $( echo /${result} ) \n"
9596 done
9697 IFS=$OLDIFS
9798 else
@@ -155,9 +156,9 @@ remove_note() {
155156open_something () {
156157 if [[ -p /dev/stdin ]]; then
157158 read -d $" \n" note_names
158- while read note_name; do
159+ while read note_name; do
159160 buffer+=" ${note_name} ,"
160- done <<< " $note_names"
161+ done <<< " $note_names"
161162 open_note ${buffer[@]}
162163 elif [ $# -gt 0 ]; then
163164 open_note " $* "
@@ -168,15 +169,15 @@ open_something() {
168169
169170open_note () {
170171 local note_path
171- local ext_check
172- local buffer=$@
172+ local ext_check
173+ local buffer=$@
173174 local files=()
174175
175- OLDIFS=$IFS ; IFS=' ,'
176- for file in $buffer ; do
177- note_path=$file
176+ OLDIFS=$IFS ; IFS=' ,'
177+ for file in $buffer ; do
178+ note_path=$file
178179 ext_check=$( echo ${note_path: 1:- 1} | grep -e ' \.[a-z]' )
179- if [[ -z ${ext_check} ]]; then
180+ if [[ -z ${ext_check} ]]; then
180181 note_path=" $note_path$file_ext "
181182 fi
182183 if [ ! -f " $note_path " ]; then
Original file line number Diff line number Diff line change @@ -70,8 +70,8 @@ notes="./notes"
7070 run bash -c " $notes find | $notes open"
7171
7272 assert_success
73- assert_line " Editing $NOTES_DIRECTORY /note.md"
74- assert_line " Editing $NOTES_DIRECTORY /note2.md"
73+ assert_line " Editing $NOTES_DIRECTORY /note2.md $NOTES_DIRECTORY / note.md"
74+ # assert_line "Editing $NOTES_DIRECTORY/note2.md"
7575}
7676
7777@test " Accepts relative notes paths to open" {
@@ -124,4 +124,4 @@ notes="./notes"
124124
125125 assert_failure
126126 assert_output " Please set \$ EDITOR to edit notes"
127- }
127+ }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ notes="./notes"
2525@test " Should fail to delete non-existent note" {
2626 run $notes rm note
2727
28- assert_failure
28+ assert_success
2929}
3030
3131@test " Should remove note in folder" {
@@ -41,7 +41,7 @@ notes="./notes"
4141 mkdir " $NOTES_DIRECTORY /folder"
4242 run $notes rm folder
4343
44- assert_failure
44+ assert_success
4545 assert_exists " $NOTES_DIRECTORY /folder"
4646}
4747
You can’t perform that action at this time.
0 commit comments