You are here

public function UnusedModulesCommands::modules in Unused Modules 8

Show unused modules or projects.

@usage drush unused-modules projects disabled Show projects that are unused. @usage drush um As above, shorthand. @usage drush unused-modules projects disabled As above, include projects with enabled modules. @usage drush unused-modules modules disabled Show modules that are unused. @usage drush unused-modules modules all As above, include enabled modules.

@table-style default @field-labels project: Project module: Module enabled: Module enabled has_modules: Project has Enabled Modules path: Project Path @default-fields project,module,enabled,has_modules,path

@command unused:modules @aliases um,unused_modules,unused-modules

Parameters

string $type: Options "projects" and "modules". Show modules or projects.

string $show: Options "all" and "disabled". Show only disabled modules.

Return value

\Consolidation\OutputFormatters\StructuredData\RowsOfFields Rows with unused project/module information.

File

src/Commands/UnusedModulesCommands.php, line 71

Class

UnusedModulesCommands
A Drush commandfile.

Namespace

Drupal\unused_modules\Commands

Code

public function modules($type = "projects", $show = "disabled") {

  // Print projects.
  if ($type == 'projects') {
    if ($show == 'all') {
      return $this
        ->showProjects('all');
    }
    elseif ($show == 'disabled') {
      return $this
        ->showProjects('disabled');
    }
    else {
      throw new \Exception("unknown 'show' argument " . $show . ". See drush unused-modules --help");
    }
  }
  elseif ($type == 'modules') {
    if ($show == 'all') {
      return $this
        ->showModules('all');
    }
    elseif ($show == 'disabled') {
      return $this
        ->showModules('disabled');
    }
    else {
      throw new \Exception("unknown 'show' argument " . $show . ". See drush unused-modules --help");
    }
  }
  else {
    throw new \Exception("unknown 'type' argument " . $type . ". See drush unused-modules --help");
  }
}