Format bash code

This commit is contained in:
Emili Castells Guasch 2023-03-31 10:21:56 +02:00
parent d1559c5bb8
commit e856369a06

View file

@ -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