From 05e5cac9765e812290689bbb56594a0f2312fc4f Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Wed, 30 Dec 2020 19:21:31 +0000 Subject: [PATCH] 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 --- inc/file-management | 2 +- kb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/file-management b/inc/file-management index 6b5ff32..7ddec7e 100644 --- a/inc/file-management +++ b/inc/file-management @@ -182,7 +182,7 @@ deleteFile(){ local filename local fileID local rsp - filename="$(findFile "$1")" + filename="$(findFile "$*")" fileID="$(findFileId "$filename")" [ ! -e "$filename" ] && exit 1 echo -n "Are you sure? [yN] " diff --git a/kb b/kb index 309925b..e5942c9 100755 --- a/kb +++ b/kb @@ -256,7 +256,7 @@ gitChange(){ else # if we get here, the file has been deleted git add "$filename" - git add "$filename.yaml" + git add "$filename.yaml" 2> /dev/null || true git commit -m "KB auto-commit: delete: $filename" fi fi