File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ grep_notes() {
27
27
return 1
28
28
fi
29
29
30
- grep_output=$( grep -r " $notes_dir " -e " $* " 2>&1 )
30
+ grep_output=$( grep -r " $notes_dir " -l - e " $* " 2>&1 )
31
31
grep_result=$?
32
32
formatted_output=$( printf " $grep_output " | without_notes_dir)
33
33
Original file line number Diff line number Diff line change @@ -28,6 +28,6 @@ notes="./notes"
28
28
run $notes grep my-pattern
29
29
30
30
assert_success
31
- assert_line " matching-node.md:my-pattern "
31
+ assert_line " matching-node.md"
32
32
refute_line " non-matching-node.md"
33
33
}
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ notes="./notes"
35
35
assert_output " Opening $NOTES_DIRECTORY "
36
36
}
37
37
38
- @test " Opens a file passed by pipe if provided " {
38
+ @test " Opens a file passed by pipe from find " {
39
39
touch $NOTES_DIRECTORY /note.md
40
40
41
41
run bash -c " $notes find | $notes open"
@@ -44,7 +44,16 @@ notes="./notes"
44
44
assert_output " Editing $NOTES_DIRECTORY /note.md"
45
45
}
46
46
47
- @test " Opens multiple files passed by pipe if provided" {
47
+ @test " Opens a file passed by pipe from grep" {
48
+ echo " hi" > $NOTES_DIRECTORY /note.md
49
+
50
+ run bash -c " $notes grep 'hi' | $notes open"
51
+
52
+ assert_success
53
+ assert_output " Editing $NOTES_DIRECTORY /note.md"
54
+ }
55
+
56
+ @test " Opens multiple files passed by pipe from find" {
48
57
touch $NOTES_DIRECTORY /note.md
49
58
touch $NOTES_DIRECTORY /note2.md
50
59
You can’t perform that action at this time.
0 commit comments