diff --git a/.config/fish/functions/makeaway.fish b/.config/fish/functions/makeaway.fish index c103f86..059322c 100644 --- a/.config/fish/functions/makeaway.fish +++ b/.config/fish/functions/makeaway.fish @@ -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