For all WP-CLI commands, arguments following a long switch are interpreted as positional without =:
$ wp user list --role admin
Error: Too many positional arguments: admin
$ wp user list --role=admin
+----+------------+--------------+------------+-----------------+-------+
| ID | user_login | display_name | user_email | user_registered | roles |
+----+------------+--------------+------------+-----------------+-------+
+----+------------+--------------+------------+-----------------+-------+
This is unhandy, but acceptable.
However, it becomes a real usablity issue when calling WP-CLI programmatically.
In my case, Python's subprocess.run is used to call WP-CLI (with shell=False for obvious security reasons).
As a result, I have to do this:
command.append(f"--path={self.path}")
... instead of:
command.extend(["--path", self.path])
This way of working delegates string interpolation - and sometimes even quoting - to the caller, which is not developer-friendly (and probably not very POSIX-y).
For all WP-CLI commands, arguments following a long switch are interpreted as positional without
=
:This is unhandy, but acceptable.
However, it becomes a real usablity issue when calling WP-CLI programmatically.
In my case, Python's
subprocess.run
is used to call WP-CLI (withshell=False
for obvious security reasons).As a result, I have to do this:
... instead of:
This way of working delegates string interpolation - and sometimes even quoting - to the caller, which is not developer-friendly (and probably not very POSIX-y).