From 4d87c0bde9f46bd59c4a19d5ee5e31a4427f0b71 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Fri, 7 Jun 2019 16:46:04 +0200 Subject: [PATCH] Fixes bugs in vimrecover --- bin/vim-recover | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/vim-recover b/bin/vim-recover index 335fc82..6773200 100755 --- a/bin/vim-recover +++ b/bin/vim-recover @@ -1,16 +1,21 @@ #!/usr/bin/env bash # Check recovery directory from vim +if [ $# -lt 1 ]; then + echo -e >&2 "\033[31;1merror:\033[0m vim-recover expects an argument" + exit 1 +fi + if [ -f $1 ]; then - echo >&2 Cannot recover an existing file... - return 1 + echo -e >&2 "\033[31;1merror:\033[0m cannot recover an existing file" + exit 1 fi backup_path=~/.nvim/backups/`echo $PWD/$1 | tr '/' '%'` if [ ! -f "$backup_path" ]; then - echo >&2 Backup not found... - return 2 + echo -e >&2 "\033[31;1merror:\033[0m backup not found" + exit 2 fi cp $backup_path $1