mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Format bash code
This commit is contained in:
parent
d1559c5bb8
commit
e856369a06
1 changed files with 15 additions and 12 deletions
|
@ -1,27 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
help-panel(){
|
||||
echo -e "-d [post_type] Delete all posts"
|
||||
echo -e "\tExample: -d shop_order,product"
|
||||
help-panel() {
|
||||
echo -e "-d [post_type] Delete all posts"
|
||||
echo -e "\tExample: -d shop_order,product"
|
||||
}
|
||||
|
||||
delete-post(){
|
||||
delete-post() {
|
||||
for post in $(wp post list --post_type=$1 --format=ids --path=.ddev/wordpress); do
|
||||
wp post delete $post --force --path=.ddev/wordpress
|
||||
done
|
||||
wp post delete $post --force --path=.ddev/wordpress
|
||||
done
|
||||
}
|
||||
|
||||
declare -i parameter_counter=0
|
||||
|
||||
while getopts "d:h" arg; do
|
||||
case $arg in
|
||||
d) post_type=$OPTARG; let parameter_counter+=1;;
|
||||
h) help-panel;;
|
||||
esac
|
||||
case $arg in
|
||||
d)
|
||||
post_type=$OPTARG
|
||||
let parameter_counter+=1
|
||||
;;
|
||||
h) help-panel ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $parameter_counter -eq 1 ]; then
|
||||
delete-post $post_type
|
||||
delete-post $post_type
|
||||
else
|
||||
help-panel
|
||||
help-panel
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue