output to stderr, check if directory exists

This commit is contained in:
Mylloon 2023-10-08 16:43:39 +02:00
parent 1e2a7faa3c
commit 6cd79838c6
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -8,6 +8,13 @@ function makeaway
return 0
end
# Check if directory exists
set directory $argv[1]
if not test -d $directory
echo "Directory doesn't exists." 1>&2
return 1
end
# Find the target
set target ""
if test (count $argv) -ge 3 && test "$argv[2]" = --
@ -15,12 +22,12 @@ function makeaway
set target $argv[3]
else if test (count $argv) -ge 2 && test "$argv[2]" = --
# User used "--" without target
echo "No target found."
echo "No target found." 1>&2
return 1
end
# Make
cd $argv[1]
cd $directory
make $target
cd -
end