Index: modules/contrib/config_devel/drush/config_devel.drush.inc
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- modules/contrib/config_devel/drush/config_devel.drush.inc	(revision )
+++ modules/contrib/config_devel/drush/config_devel.drush.inc	(revision )
@@ -7,6 +7,11 @@
 
 use Drupal\Core\Config\InstallStorage;
 
+DEFINE('MODULE_TYPE', 'module');
+DEFINE('THEME_TYPE', 'theme');
+DEFINE('PROFILE_TYPE', 'profile');
+
+
 /**
  * Implements hook_drush_command().
  */
@@ -16,12 +21,12 @@
   $description = '';
   $description .= "Write back configuration to module's config/install directory." . "\n";
   $description .= "List which configuration settings you want to export in the" . "\n";
-  $description .= "module's info file by listing them under 'config_devel', as shown below:"  . "\n";
+  $description .= "module's info file by listing them under 'config_devel', as shown below:" . "\n";
   $description .= "\n";
-  $description .= "config_devel:"  . "\n";
+  $description .= "config_devel:" . "\n";
-  $description .= "  - entity.view_display.node.article.default"  . "\n";
+  $description .= "  - entity.view_display.node.article.default" . "\n";
-  $description .= "  - entity.view_display.node.article.teaser"  . "\n";
+  $description .= "  - entity.view_display.node.article.teaser" . "\n";
-  $description .= "  - field.instance.node.article.body"  . "\n";
+  $description .= "  - field.instance.node.article.body" . "\n";
 
   $items['config-devel-export'] = array(
     'description' => $description,
@@ -29,6 +34,7 @@
       'module' => 'Module machine name.',
     ),
     'options' => array(
+      'type' => 'Extension type, could be module, theme or profile. Default to: module.'
     ),
     'required-arguments' => TRUE,
     'examples' => array(
@@ -45,10 +51,13 @@
  * Drush command callback.
  */
 function drush_config_devel_export($extension) {
+  $type = drush_get_option('type', MODULE_TYPE);
 
-  if (($module_exists = \Drupal::moduleHandler()->moduleExists($extension)) || \Drupal::service('theme_handler')->themeExists($extension)) {
-    $type = $module_exists ? 'module' : 'theme';
+  if ($extension && ($type == MODULE_TYPE && \Drupal::moduleHandler()
+        ->moduleExists($extension)) || ($type == THEME_TYPE && \Drupal::service('theme_handler')
+        ->themeExists($extension)) || ($type == PROFILE_TYPE)
+  ) {
-    $filename = drupal_get_path($type, $extension) . '/' . $extension .'.info.yml';
+    $filename = drupal_get_path($type, $extension) . '/' . $extension . '.info.yml';
     $info = \Drupal::service('info_parser')->parse($filename);
 
     if (isset($info['config_devel'])) {
@@ -81,8 +90,11 @@
 function drush_config_devel_process_config($config_list, $type, $extension, $directory) {
   $config_path = drupal_get_path($type, $extension) . "/$directory";
   foreach ($config_list as $name) {
+    if ($name) {
-    $config = \Drupal::config($name);
-    $file_names = array($config_path . '/' . $name . '.yml');
+      $config = \Drupal::config($name);
+      $file_names = array($config_path . '/' . $name . '.yml');
-    \Drupal::service('config_devel.writeback_subscriber')->writeBackConfig($config, $file_names);
+      \Drupal::service('config_devel.writeback_subscriber')
+        ->writeBackConfig($config, $file_names);
+    }
   }
 }
