Closed ivillacreative closed 6 years ago
I'm not sure it is related to your problem, but I found a bug at https://github.com/wckr/wocker-cli/blob/master/wocker#L370.
--- wocker
+++ wocker.patched
@@ -367,7 +367,7 @@
cid=$(docker ps -q)
if [[ ! $cid =~ $'\n' ]]; then
if [[ "$2" = 'shell' ]]; then
- docker exec -u $USER -it $cid wp ${@:2}
+ docker exec -u $USER -it $cid wp ${@:3}
else
docker exec -u $USER $cid wp ${@:2}
fi
wocker ~ $ wocker wp shell db reset
Are you sure you want to reset the database? [y/n] y
Success: Database reset.
Ah. It's not a bug. My above patch is not good for the shell subcommand itself. Sorry.
I thought the shell
was the keyword for an interactive mode, but a subcommand.
Revised the patch.
--- wocker
+++ wocker.patched
@@ -366,11 +366,7 @@
if [[ $(docker ps -q) ]]; then
cid=$(docker ps -q)
if [[ ! $cid =~ $'\n' ]]; then
- if [[ "$2" = 'shell' ]]; then
- docker exec -u $USER -it $cid wp ${@:2}
- else
- docker exec -u $USER $cid wp ${@:2}
- fi
+ docker exec -u $USER -it $cid wp ${@:2}
fi
fi
fi
wocker ~ $ wocker wp db reset
Are you sure you want to reset the database? [y/n] y
Success: Database reset.
My patch may be not good for other subcommands.
The commands which have interactive mode are shell
and db
only?
BTW, after db reset, I got an error.
Error: The site you have requested is not installed.
Run `wp core install`.
I looked up the WP-CLI docs, you can get passed the [y/n] by adding a '--yes' flag.
so this would work wocker ~ $ wocker wp db reset --yes
Yes, it does with the original wocker-cli. So what is your problem exactly?
Anyway the current wocker wp
command doesn't work well with an interactive mode except shell
.
well using the flag seems to solve this problem of not being able to get passed the [y/n] confirmation WP-CLI asked for.
and I do agree about wocker wp
I see. Thank you for the clarification. Ping @ixkaito
Thank you both @ivanvillacreative @ailispaw . I'll find a better solution about this issue.
Fixed.
When attempting to reset the wordpress database using WP-CLI, I get an error when trying to confirm [y/n].