From 7960f780191c565a546addc9ab1fb04f9048a1d7 Mon Sep 17 00:00:00 2001 From: Charles Thorley Date: Fri, 13 Dec 2013 18:10:13 -0800 Subject: [PATCH] Additional gatekeeping --- plugins/jump/mark.fish | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/jump/mark.fish b/plugins/jump/mark.fish index 5f23f41..7a228db 100644 --- a/plugins/jump/mark.fish +++ b/plugins/jump/mark.fish @@ -1,5 +1,13 @@ function mark - if test (count $argv) -eq 1 + if test (count $argv) -eq 0 -o (count $argv) -gt 2 + echo "Usage: mark [DIRECTORY]" + else if test -e $MARKPATH/$argv[1] + if test -d $MARKPATH/$argv[1] -a -L $MARKPATH/$argv[1] + echo "A mark named $argv[1] already exists." + else + echo "$MARKPATH/$argv[1] already exists." + end + else if test (count $argv) -eq 1 command ln -s (pwd) $MARKPATH/$argv[1] else if test (count $argv) -eq 2 if test -d $argv[2] @@ -10,7 +18,5 @@ function mark else echo "$argv[2] is not a valid directory." end - else - echo "Usage: mark [DIRECTORY]" end end