backdrop-contrib / brush

Brush is a command line shell and Unix scripting interface for Backdrop CMS.
GNU General Public License v3.0
2 stars 0 forks source link

Introduce new command to quickly find to which configuration file belongs a given variable #12

Closed alanmels closed 4 years ago

alanmels commented 4 years ago

Quote from https://github.com/backdrop-contrib/brush/issues/2#issuecomment-701918728:

In any event forcing a user to know what the JSON file name is for some variable they need to look up is fairly counterproductive. It’d suck though to have to use a disk scan, although for a temporary measure it’d be okay I guess.

I think we could add a new feature to brush, that enables quickly finding the right JSON file. Would be totally different from drush and so useful to Backdrop.

alanmels commented 4 years ago

This has been fixed by https://github.com/backdrop-contrib/brush/commit/7b14637d5ddc43f213219b6e225fe03cf5f995af

brush help cget
Get a list of some or all site variables and values.

Examples:
+----------------------------------------+------------------------------------------------------------------+
| brush config-get                       | List all variables and values.                                   |
| brush config-get system.core           | List all variables in "system.core.json" file.                   |
| brush config-get system.core clean_url | Display value of "clean_url" key in "system.core.json" file.     |
| brush cget entity_type                 | List values of the "entity_type" key in all configuration files. |
| brush cget *entity*                    | List variables whose keys contain string "entity".               |
+----------------------------------------+------------------------------------------------------------------+

Arguments:
+-------------------------------+----------------------------------------------------+
| config-name                   | The config object name, for example "system.core". |
| key                           | The config key, for example "clean_url".           |
+-------------------------------+----------------------------------------------------+

Options:
+-------------------------------+------------------------------------------------------------------------+
| --pipe                        | Use var_export() to emit executable PHP. Useful for pasting into code. |
+-------------------------------+------------------------------------------------------------------------+

Aliases: cget, vget