Improve support for cases with empty --path provided to wp-cli commands by wojtekn · Pull Request #5709 · wp-cli/wp-cli
I propose fixing the confusing messaging we show if an empty --path parameter is provided to command calls.
The empty parameter is considered a true flag, let's treat it as empty path:
% bin/wp import --path
Error: The --path parameter cannot be empty when it is provided
This is also an empty parameter considered a true flag because there is no equal sign used to assign a path to the parameter. Let's treat it as an empty path too:
% bin/wp import --path some
Error: The --path parameter cannot be empty when it is provided
Then handle an empty string as an empty path:
% bin/wp import --path=
Error: The --path parameter cannot be empty when it is provided
When a non-empty path is provided, include the full working directory in the error message:
% bin/wp import --path=some
Error: This (/Volumes/Sites/wp-cli/some/) does not seem to be a WordPress installation.
Pass --path=`path/to/wordpress` or run `wp core download`.
Fixes: #5559