backdrop-contrib / bee

:bee: Bee is a command line utility for Backdrop CMS. It includes commands that allow developers to interact with Backdrop sites.
GNU General Public License v2.0
16 stars 22 forks source link

Add 'config-clear' command and fix bug in 'config-set' #411

Closed bugfolder closed 2 months ago

bugfolder commented 2 months ago

It would be nice to have the bee config-clear file option command to clear (remove) an option from a config file.

What's the use case? Well, if you used bee config-set file option value but mistyped the name of the option, you would have created an option that you can no longer remove via bee.

Or at least that would be possible if there were not a bug in bee config-set. Although the code clearly anticipates creating a nonexistent option (the switch statement has a branch for a NULL result for $existing_type), that branch is currently unreachable. So the PR for this issue fixes that bug, as well as implementing the bee config-clear command.

And the reason I'm doing the two things together is that we need both working functions for the test code, which I've added for both functions (creating a nonexistent option, then subsequently clearing it).

bugfolder commented 2 months ago

Although there are test fails, config-related tests are all passing, so ready for review and human testing.