Commit 204a5727 authored by Ander Punnar's avatar Ander Punnar

__link: add messaging

parent 13671c66
......@@ -48,21 +48,25 @@ case "$state_should" in
if [ "$file_type" = "directory" ]; then
# our destination is currently a directory, delete it
printf 'rm -rf "%s" &&\n' "$destination"
echo "removed '$destination' (directory)" >> "$__messages_out"
else
if [ "$state_is" = "wrongsource" ]; then
# our destination is a symlink but points to the wrong source,
# delete it
printf 'rm -f "%s" &&\n' "$destination"
echo "removed '$destination' (wrongsource)" >> "$__messages_out"
fi
fi
# create our link
printf 'ln %s -f "%s" "%s"\n' "$lnopt" "$source" "$destination"
echo "created '$destination'" >> "$__messages_out"
;;
absent)
# only delete if it is a sym/hard link
if [ "$file_type" = "symlink" ] || [ "$file_type" = "hardlink" ]; then
printf 'rm -f "%s"\n' "$destination"
echo "removed '$destination'" >> "$__messages_out"
fi
;;
*)
......
......@@ -27,6 +27,22 @@ state
'present' or 'absent', defaults to 'present'
MESSAGES
--------
created <destination>
Link to destination was created.
removed <destination>
Link to destination was removed.
removed <destination> (directory)
Destination was removed because state is ``present`` and destination was directory.
removed <destination> (wrongsource)
Destination was removed because state is ``present`` and destination link source was wrong.
EXAMPLES
--------
......
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