Commit 6b4b6534 authored by ssrq's avatar ssrq

[__directory] Give more precise error message when --state pre-exists

parent 2cf44c66
......@@ -109,10 +109,24 @@ case "$state_should" in
done
;;
pre-exists)
if [ "$type" != "directory" ]; then
echo "Directory \"$destination\" does not exist" >&2
exit 1
fi
case $type in
directory)
# all good
exit 0
;;
none)
printf 'Directory "%s" does not exist\n' "$destination" >&2
exit 1
;;
file|symlink)
printf 'File "%s" exists and is a %s, but should be a directory\n' "$destination" "$type" >&2
exit 1
;;
*)
printf 'File or directory "%s" is in an unknown state\n' "$destination" >&2
exit 1
;;
esac
;;
absent)
if [ "$type" = "directory" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment