Skip to content

ProcessWireCli: help screen still runs executeCli([]) — confusing output for CLI modules that don't handle empty args (8056c484) #2245

@adrianbj

Description

@adrianbj

Short description of the issue

In commit 8056c484, ProcessWireCli::executeCommand() renders the help screen when no args are given, then continues and calls $mod->executeCli([]) anyway. CLI modules whose executeCli doesn't gracefully handle an empty args array emit confusing output (or fail) after the help text.

Expected behavior

php index.php some-command (no args) prints the help screen and returns without invoking the command's CLI handler.

Actual behavior

wire/core/Tools/ProcessWireCli.php:97-116:

if(empty($args)) {
    echo $this->renderHelp($name);
}
try { $mod->executeCli($args); ... }

There's no return / continue after renderHelp(). The result is help text immediately followed by whatever the module's executeCli([]) produces — often an error or another help dump.

Optional: Suggestion for a possible fix

if(empty($args)) {
    echo $this->renderHelp($name);
    return;
}

Setup/Environment

  • ProcessWire version: dev @ 15c749ed
  • File: wire/core/Tools/ProcessWireCli.php:97-116
  • Introduced in commit 8056c484

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions