Skip to content

feat: add AbstractCommand::callSilently()#10177

Merged
paulbalandan merged 1 commit into
codeigniter4:4.8from
paulbalandan:call-silent
May 12, 2026
Merged

feat: add AbstractCommand::callSilently()#10177
paulbalandan merged 1 commit into
codeigniter4:4.8from
paulbalandan:call-silent

Conversation

@paulbalandan
Copy link
Copy Markdown
Member

@paulbalandan paulbalandan commented May 9, 2026

Description
Extracted from michalsn's review on #10174.

Adds AbstractCommand::callSilently($command, $arguments, $options, $noInteractionOverride = true) to invoke another modern command with its output discarded, so the parent can emit its own consolidated message.

Supporting pieces:

  • CodeIgniter\CLI\NullInputOutput — an InputOutput sink that discards writes and returns an empty string from input().
  • CLI::getInputOutput() (@internal) — getter symmetric to the existing setInputOutput() / resetInputOutput() pair.
  • CLI::getLastWrite() / CLI::setLastWrite() (@internal) — snapshot-and-restore accessors for $lastWrite so the silenced sub-command's writes don't leak the "suppress leading newline" state into the parent's next output.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@github-actions github-actions Bot added the 4.8 PRs that target the `4.8` branch. label May 9, 2026
@paulbalandan paulbalandan mentioned this pull request May 9, 2026
5 tasks
Comment thread system/CLI/AbstractCommand.php
@paulbalandan paulbalandan force-pushed the call-silent branch 2 times, most recently from 2afd543 to 43a60f0 Compare May 11, 2026 17:21
Copy link
Copy Markdown
Member

@michalsn michalsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@paulbalandan paulbalandan merged commit 31643c1 into codeigniter4:4.8 May 12, 2026
56 checks passed
@paulbalandan paulbalandan deleted the call-silent branch May 12, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants