Make dotify-action error out when given invalid actions

This commit is contained in:
2013-10-21 01:30:42 +01:00
parent 27f163e9fe
commit fad6369ba7
2 changed files with 35 additions and 0 deletions

View File

@@ -7,5 +7,11 @@ dotify-action() {
action="$DOTIFY_OPT_DEFAULT_ACTION"
fi
! valid_action="$(command -v "dotify-action-${action}")"
if [ -z "$valid_action" ]; then
echo "ERROR: \"$action\" is not a valid action." >&2
return 1
fi
dotify-action-${action} "$source" "$target"
}