Skip to content

Commit 5de8189

Browse files
committed
Fix bug to now allow spaces in file
1 parent 7936f13 commit 5de8189

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

notes

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ remove_note() {
128128

129129
open_something() {
130130
if [[ -p /dev/stdin ]]; then
131-
read -d'\n' note_names
131+
read -d $"\n" note_names
132132
local buffer=()
133133
while read note_name; do
134-
buffer+=$note_name
134+
buffer+="${note_name},"
135135
done <<< "$note_names"
136-
open_note $note_names
136+
open_note ${buffer[@]}
137137
elif [ $# -gt 0 ]; then
138138
open_note "$*"
139139
else
@@ -144,11 +144,13 @@ open_something() {
144144
open_note() {
145145
local note_path
146146
local ext_check
147-
local buffer=()
147+
local buffer=$@
148+
local files=()
148149

149-
for arg in $@; do
150+
IFS=','
151+
for arg in $buffer; do
150152
ext_check=true
151-
note_path=$arg
153+
note_path="$arg"
152154
if echo $note_path | grep -q '\.[a-z]'; then
153155
ext_check=false
154156
fi
@@ -162,10 +164,10 @@ open_note() {
162164
printf "Please set \$EDITOR to edit notes\n"
163165
exit 1
164166
fi
165-
buffer+="$note_path "
167+
files+=(${note_path})
166168
done
167169

168-
$EDITOR $buffer < /dev/tty
170+
$EDITOR ${files[@]} < /dev/tty
169171
}
170172

171173
usage() {

0 commit comments

Comments
 (0)