Skip to content

Commit

Permalink
Fix #5146. Document single file config import using config:set (#5543)
Browse files Browse the repository at this point in the history
* Add Usage to cim

* More usages examples for single file config import
  • Loading branch information
weitzman committed Apr 23, 2023
1 parent 87a3ef2 commit 3dcf889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Drupal/Commands/config/ConfigCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public function get($config_name, $key = '', $options = ['format' => 'yaml', 'so
#[CLI\Usage(name: 'drush config:set --input-format=yaml user.role.authenticated permissions [foo,bar]', description: 'Use a sequence as value for the key <info>permissions</info> of <info>user.role.authenticated</info> config object.')]
#[CLI\Usage(name: "drush config:set --input-format=yaml system.site page {403: '403', front: home}", description: 'Use a mapping as value for the key <info>page</info> of <info>system.site</info> config object.')]
#[CLI\Usage(name: 'drush config:set --input-format=yaml user.role.authenticated ? "{label: \'Auth user\', weight: 5}"', description: 'Update two top level keys (label, weight) in the <info>system.site</info> config object.')]
#[CLI\Usage(name: 'cat tmp.yml | drush config:set --input-format=yaml user.mail ? -', description: 'Update the <info>user.mail</info> config object in its entirety.')]
#[CLI\Complete(method_name_or_callable: 'configComplete')]
public function set($config_name, $key, $value, $options = ['input-format' => 'string'])
{
Expand Down
3 changes: 3 additions & 0 deletions src/Drupal/Commands/config/ConfigImportCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ public function __construct(
#[CLI\Option(name: 'source', description: 'An arbitrary directory that holds the configuration files.')]
#[CLI\Option(name: 'partial', description: 'Allows for partial config imports from the source directory. Only updates and new configs will be processed with this flag (missing configs will not be deleted). No config transformation happens.')]
#[CLI\Bootstrap(level: DrupalBootLevels::FULL)]
#[CLI\Usage(name: 'drush config:import', description: 'Update Drupal\'s configuration so it matches the contents of the config directory.')]
#[CLI\Usage(name: 'drush config:import --partial --source=/app/config', description: 'Import from the /app/config directory which typically contains one or a few yaml files.')]
#[CLI\Usage(name: 'cat tmp.yml | drush config:set --input-format=yaml user.mail ? -', description: 'Update the <info>user.mail</info> config object in its entirety.')]
#[CLI\Topics(topics: [DocsCommands::DEPLOY])]
public function import(array $options = ['source' => self::REQ, 'partial' => false, 'diff' => false])
{
Expand Down

0 comments on commit 3dcf889

Please sign in to comment.