bee
bee copied to clipboard
Add a --quiet option for bee commands.
What I had in mind was something like the if($type == 'log' && !b_is_debug())
filter in includes/common.inc
(around line 84) that would similarly filter out status, success and log messages.
The goal is to have the --quiet
option either suppress all output (like drush) and note success or failure through the return value in $?, or they reduce the output, removing the progress and status messages, but leaving any warnings or errors. Some commands (mplayer, for example) support multiple levels of quiet, like multiple levels of -v for verbosity.
For example using b
to trigger cron is a common use case. The current version of b
will print out a success message if everything works, which when run through cron creates a lot of emails.
We should add a --quiet
(-q
) option that doesn't print out any of the success or log messages, just the errors and warnings. Perhaps two -q
options could suppress the warnings, too.
~~PR at https://github.com/backdrop-contrib/b/pull/25~~ closed in favour of more general approach.
@jlfranklin if you get some time please review if all is working feel free to merge.
Hi! :) We are currently converting a complex Drupal 7 site to Backdrop and we are using bee to assist in clearing cache. We see that bee is making a lot of noises in regards to warnings and notice output :D
We added a much needed Verbose
option. We will have that ready soon.
Cheers!
I like the initial idea here (no text output, only the exit code states if there's success or failure), for silent automatic runs like system cron.
But it doesn't appear to me that this is what the PR accomplishes. Correct me if I'm wrong.
@rbargerhuff there's an additional issue that deals with the "noise" on PHP 8 when running cc
or cron
.
We have quite a few different ideas going on here. Either quiet all the time and allow verbose or the other way round; current level of noise but excluding the PHP errors with an option to go quiet.
download
and download-core
already have a --hide-progress
option which makes it quiet, so the default there is normally show progress but allow to hide it.
Given that the original request was for quiet mode, and that this would work with download (we could look for the --hide-progress
or --quiet
at least initially to avoid breaking scripts), I'm minded to go with this, but what could be tricky is all the different functions that generate noise; not every message is generated in bee
. We need to try and handle errors rather than just suppressing them normally.
Hello everyone,
When @smaiorana and I first submitted this PR, we were attempting to get the Memcache module in Drupal 7 to work with Backdrop. When we attempted to clear-cache
, we were getting extra output from the clear-cache
command. We only decided to add --verbose
as a way to silent bee
's information output, which is drush's
default behavior. For example, with --verbose
...
drush --verbose cc all
Executing: mysql --defaults-extra-file=/tmp/drush_xyZw0O --database=dsA --host=localhost --silent < /tmp/drush_9jnyYb
Executing: mysql --defaults-extra-file=/tmp/drush_wfux74 --database=dsA --host=localhost --silent < /tmp/drush_emt13r
'all' cache was cleared. [success]
Command dispatch complete
Without --verbose
, drush
only output:
'all' cache was cleared. [success]
When we reviewed our intentions for the PR, we realized that the original issue posted by @jlfranklin was asking for a --quiet
switch which until now, did not know drush
even had because it's not documented very well.
The --quiet
option is part of drush's
integration with cron. We both feel that --quiet
option must be added so that the full command is bee --quiet
😂
We feel a --verbose
option is needed if there are plans to output watchdog
messages to the user.
For now, our PR is no longer needed and will bee
discarded 😂
Thanks @rbargerhuff - it's good to understand the use cases and think about how best to implement this. At the moment I don't have a clear strategy how to do this, but I do agree it would still be good to do.