Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(console): support "no prompt" mode #661

Merged

Conversation

innocenzi
Copy link
Member

@innocenzi innocenzi commented Nov 2, 2024

This pull request implements a "no prompt" mode. This mode can be enabled by passing the --no-interaction flag to any command.

That mode disables all user interactions with the console. Instead, default values will be used when provided, otherwise null or empty arrays will be returned by input components.

To support this mode, some components and their static version needed a new default option, which this pull request includes.

Additional changes:

  • The Console interface has a new disablePrompting and disableTty method to, well, disable prompting and TTY programmatically.
  • The interactiveSupported is renamed to supportsTty, and supportsPrompting has been added. Both have been added to the interface and made public.
  • The ConsoleTester class has a new withoutPrompting method to ease testing.
  • I also added a dd method to ConsoleTester, which is quite unrelated but I always try to reach for it.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11640109947

Details

  • 66 of 83 (79.52%) changed or added relevant lines in 13 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.05%) to 82.241%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Tempest/Console/src/Initializers/ConsoleInitializer.php 1 2 50.0%
src/Tempest/Console/src/Testing/ConsoleTester.php 6 12 50.0%
src/Tempest/Console/src/GenericConsole.php 15 25 60.0%
Files with Coverage Reduction New Missed Lines %
src/Tempest/Console/src/Initializers/ConsoleInitializer.php 1 55.88%
src/Tempest/Console/src/GenericConsole.php 3 75.0%
Totals Coverage Status
Change from base Build 11622363967: -0.05%
Covered Lines: 7053
Relevant Lines: 8576

💛 - Coveralls

@brendt
Copy link
Member

brendt commented Nov 2, 2024

I merged #660, feel free to rebase, I'll review afterwards, but I'm fairly confident this can be merged 👍

@innocenzi innocenzi force-pushed the feat/console/support-no-interactions branch from c1b783b to 444ca2e Compare November 2, 2024 14:06
@innocenzi innocenzi marked this pull request as ready for review November 2, 2024 14:07
@innocenzi
Copy link
Member Author

Thanks! Rebased, and ready for review

@innocenzi innocenzi force-pushed the feat/console/support-no-interactions branch from 444ca2e to 0c7b699 Compare November 6, 2024 00:22
@innocenzi innocenzi requested a review from brendt November 6, 2024 00:23
@brendt brendt merged commit 687e333 into tempestphp:main Nov 6, 2024
57 checks passed
@brendt
Copy link
Member

brendt commented Nov 6, 2024

Let's go!! 🌊

@innocenzi innocenzi deleted the feat/console/support-no-interactions branch November 6, 2024 11:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants