Additional gatekeeping

This commit is contained in:
Charles Thorley 2013-12-13 18:10:13 -08:00
parent 930753ddbe
commit 7960f78019

View File

@ -1,5 +1,13 @@
function mark function mark
if test (count $argv) -eq 1 if test (count $argv) -eq 0 -o (count $argv) -gt 2
echo "Usage: mark <MARK_NAME> [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] command ln -s (pwd) $MARKPATH/$argv[1]
else if test (count $argv) -eq 2 else if test (count $argv) -eq 2
if test -d $argv[2] if test -d $argv[2]
@ -10,7 +18,5 @@ function mark
else else
echo "$argv[2] is not a valid directory." echo "$argv[2] is not a valid directory."
end end
else
echo "Usage: mark <MARK_NAME> [DIRECTORY]"
end end
end end