Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Allow input stream termination by sending end-of-transmission character #937

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Feb 8, 2023

In addition to the added '<<<' sequence added in #936, this PR allows for an alternate method to terminate an input stream: by sending an End-of-Transmission character, usually via CTRL+D

You still need to finish with hitting enter as I have not yet figured out a way to read live input instead of a line-to-line basis.

Edit: It seems like CTRL+D on Windows sends an EOT Ascii character, but CTRL+Z+Enter on Windows seems to provide the same result as CTRL+D on Unix. This actually seems to return false from the standard input stream in PHP, so I think we should use that. It's also what Symfony uses

Okay: ways to terminate:

  • '<<<' on single line (Windows+Unix*)
  • CTRL+D (Unix*)
  • CTRL+D then enter (Windows)
  • CTRL+Z then enter (Windows)

*Tested only in WSL2 but should work on actual Linux and macOS systems.

This IMO is nicer than the Symfony implementation, as it allows for cross platform CTRL+D support (in theory).

The PR also updates output messages for this and the previous change, hence why the PR is so comparatively big.

@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #937 (5e94b54) into publications-feature (ad5afcc) will not change coverage.
The diff coverage is n/a.

❗ Current head 5e94b54 differs from pull request most recent head 7864de5. Consider uploading reports for the commit 7864de5 to get more accurate results

@@                    Coverage Diff                     @@
##             publications-feature      #937     +/-   ##
==========================================================
  Coverage                  100.00%   100.00%             
+ Complexity                   3194      1601   -1593     
==========================================================
  Files                         348       174    -174     
  Lines                        7962      3985   -3977     
==========================================================
- Hits                         7962      3985   -3977     
Impacted Files Coverage Δ
...ations/src/Commands/Helpers/InputStreamHandler.php 100.00% <0.00%> (ø)
...ations/src/Commands/Helpers/InputStreamHandler.php
...blications/src/Commands/MakePublicationCommand.php
...cations/src/Commands/MakePublicationTagCommand.php
...s/publications/src/PublicationsServiceProvider.php
packages/framework/src/Pages/Concerns/HydePage.php
packages/framework/src/Facades/Site.php
...ework/Features/Navigation/DocumentationSidebar.php
...ications/src/Actions/CreatesNewPublicationPage.php
...s/src/Commands/ValidatePublicationTypesCommand.php
... and 165 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@caendesilva caendesilva force-pushed the change-input-string-handler-termination-sequence branch from 5e94b54 to b60b017 Compare February 8, 2023 21:01
@caendesilva caendesilva merged commit dc92431 into publications-feature Feb 8, 2023
@caendesilva caendesilva deleted the change-input-string-handler-termination-sequence branch February 8, 2023 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants