shell-command icon indicating copy to clipboard operation
shell-command copied to clipboard

Option to suppress output?

Open edent opened this issue 2 years ago • 3 comments

Feature Request

When dealing with complex queries, WP Shell often dumps large volumes of data on to my screen.

For example, running a query with 'posts_per_page'=> 200, will result in hundreds of blog posts being printed. But I only want, say, the GUID.

Describe the solution you'd like

I'd like a command-line option so that wp shell --no-output will only display what I explicitly echo.

Current version:

wp shell wp> $a = "hello"; => string(5) "hello"

Proposed version:

wp shell --no-output wp> $a = "hello"; wp>

edent avatar Oct 02 '23 08:10 edent

We could potentially repurpose the --quiet global argument for this.

Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices.

danielbachhuber avatar Oct 10 '23 16:10 danielbachhuber

Thanks. Am I right in thinking the functionality just needs to be altered in:

https://github.com/wp-cli/shell-command/blob/f470d04a597e294ef29ad73dace9d4de98df7c42/src/WP_CLI/Shell/REPL.php#L39

edent avatar Oct 11 '23 09:10 edent

@edent That might be it!

danielbachhuber avatar Oct 11 '23 10:10 danielbachhuber