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
20
20
fi
21
21
22
22
without_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"
24
24
}
25
25
26
26
ls_notes () {
@@ -91,7 +91,8 @@ grep_notes() {
91
91
IFS=$' \n '
92
92
for result in $matches ; do
93
93
len=${# result}
94
- grep_output+=" $( echo ${result} ) \n"
94
+ result=$( echo $result | cut -d' /' -f2-)
95
+ grep_output+=" $( echo /${result} ) \n"
95
96
done
96
97
IFS=$OLDIFS
97
98
else
@@ -155,9 +156,9 @@ remove_note() {
155
156
open_something () {
156
157
if [[ -p /dev/stdin ]]; then
157
158
read -d $" \n" note_names
158
- while read note_name; do
159
+ while read note_name; do
159
160
buffer+=" ${note_name} ,"
160
- done <<< " $note_names"
161
+ done <<< " $note_names"
161
162
open_note ${buffer[@]}
162
163
elif [ $# -gt 0 ]; then
163
164
open_note " $* "
@@ -168,15 +169,15 @@ open_something() {
168
169
169
170
open_note () {
170
171
local note_path
171
- local ext_check
172
- local buffer=$@
172
+ local ext_check
173
+ local buffer=$@
173
174
local files=()
174
175
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
178
179
ext_check=$( echo ${note_path: 1:- 1} | grep -e ' \.[a-z]' )
179
- if [[ -z ${ext_check} ]]; then
180
+ if [[ -z ${ext_check} ]]; then
180
181
note_path=" $note_path$file_ext "
181
182
fi
182
183
if [ ! -f " $note_path " ]; then
Original file line number Diff line number Diff line change @@ -70,8 +70,8 @@ notes="./notes"
70
70
run bash -c " $notes find | $notes open"
71
71
72
72
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"
75
75
}
76
76
77
77
@test " Accepts relative notes paths to open" {
@@ -124,4 +124,4 @@ notes="./notes"
124
124
125
125
assert_failure
126
126
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"
25
25
@test " Should fail to delete non-existent note" {
26
26
run $notes rm note
27
27
28
- assert_failure
28
+ assert_success
29
29
}
30
30
31
31
@test " Should remove note in folder" {
@@ -41,7 +41,7 @@ notes="./notes"
41
41
mkdir " $NOTES_DIRECTORY /folder"
42
42
run $notes rm folder
43
43
44
- assert_failure
44
+ assert_success
45
45
assert_exists " $NOTES_DIRECTORY /folder"
46
46
}
47
47
You can’t perform that action at this time.
0 commit comments