Fix 2 bugs. Deleting file without yaml file and multi-word delete

The first bug output an error if trying to stage the deletion of the
yaml file if the file never existed. The error is now piped to /dev/null
and `|| true` is appended to the line which causes the script to carry
on execution

The second change is when deleting a file, you no longer have to quote
the file name if it is a multi word file. This puts it in line with the
new command
master
Jonathan Hodgson 4 years ago
parent 9a269628c4
commit 05e5cac976
  1. 2
      inc/file-management
  2. 2
      kb

@ -182,7 +182,7 @@ deleteFile(){
local filename local filename
local fileID local fileID
local rsp local rsp
filename="$(findFile "$1")" filename="$(findFile "$*")"
fileID="$(findFileId "$filename")" fileID="$(findFileId "$filename")"
[ ! -e "$filename" ] && exit 1 [ ! -e "$filename" ] && exit 1
echo -n "Are you sure? [yN] " echo -n "Are you sure? [yN] "

2
kb

@ -256,7 +256,7 @@ gitChange(){
else else
# if we get here, the file has been deleted # if we get here, the file has been deleted
git add "$filename" git add "$filename"
git add "$filename.yaml" git add "$filename.yaml" 2> /dev/null || true
git commit -m "KB auto-commit: delete: $filename" git commit -m "KB auto-commit: delete: $filename"
fi fi
fi fi

Loading…
Cancel
Save