Closed justinmaurerdotdev closed 1 year ago
Is that the best name for the flag?
Let's use --show-url
, similar to --show-password
for wp user reset-password
One more question before I commit the last fixes: What I've built here is an alternative to the --porcelain
output (which outputs attachment ID only) to output only the URL. Should we also provide a way to include the URL in the verbose/default output?
One idea would be to allow the --show-url
flag to be added to the default setup OR combined with --porcelain
, so that it would add a verbose output in the standard setup, or override the attachment ID in the --porcelain
output.
With --show-url
and without --porcelain
, "Imported file '%s' as attachment ID %d%s." could become "Imported file '%s' as attachment ID %d%s to URL %s."
With --show-url
AND --porcelain
, only the URL would be shown.
Does that make sense? Or should we limit this to be simply an alternative to the --porcelain
output?
@justinmaurerdotdev I don't think we need to change the default output. However, I have a better idea for a flag:
[--porcelain[=<field>]]
This is how it would work:
$ wp media import large-image.jpg --porcelain`
45
$ wp media import large-image.jpg --porcelain=url
https://example.com/wp-content/uploads/large-image.jpg
We don't need to support all fields right now, but this approach gives us the flexibility to apply the pattern across other commands.
OK, yeah. That's perfect! Will push those changes shortly.
Good deal. Changes look good. Thanks!
This addresses https://github.com/wp-cli/media-command/issues/94 Should output ONLY the URL, instead of attachment ID or verbose descriptions.
Is that the best name for the flag?
Should we also provide an option for showing the URL in the verbose output?
Related https://github.com/wp-cli/wp-cli/issues/5832