mirror of
https://github.com/N0rthernL1ghts/wordpress.git
synced 2025-02-04 13:32:51 +01:00
Add delete functionality
This commit is contained in:
parent
f79da27583
commit
1b62dba10a
|
@ -71,6 +71,24 @@ check() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Delete plugin
|
||||||
|
# $1 - plugin slug
|
||||||
|
# Returns 0 on success, X on failure
|
||||||
|
delete() {
|
||||||
|
TARGET_PLUGINS_DIR="${TARGET_PLUGINS_DIR:?delete: TARGET_PLUGINS_DIR is required}"
|
||||||
|
PLUGIN_SLUG="${1:?delete: PLUGIN_SLUG is required}"
|
||||||
|
|
||||||
|
PLUGIN_PATH="${TARGET_PLUGINS_DIR}/${PLUGIN_SLUG}"
|
||||||
|
|
||||||
|
# Check if plugin directory exists
|
||||||
|
if [ ! -d "${PLUGIN_PATH}" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "${PLUGIN_PATH}"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
# Main function
|
# Main function
|
||||||
main() {
|
main() {
|
||||||
COMMAND="${1:?COMMAND is required}"
|
COMMAND="${1:?COMMAND is required}"
|
||||||
|
@ -92,6 +110,10 @@ main() {
|
||||||
check "${@:2}"
|
check "${@:2}"
|
||||||
return $?
|
return $?
|
||||||
;;
|
;;
|
||||||
|
delete)
|
||||||
|
delete "${@:2}"
|
||||||
|
return $?
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Error: Unknown command '${COMMAND}'"
|
echo "Error: Unknown command '${COMMAND}'"
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user