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

From Discord: Getting Input from Pipe Operator #4224

Open
effect-bot opened this issue Jan 8, 2025 · 0 comments
Open

From Discord: Getting Input from Pipe Operator #4224

effect-bot opened this issue Jan 8, 2025 · 0 comments
Labels

Comments

@effect-bot
Copy link

Summary

In the discussion, participants are exploring how to handle input from a pipe operator in a TypeScript CLI application using the Effect library. Key points include:

  1. Standard Input (stdin): Typically accessed in Node.js via process.stdin. The library possibly has utilities for handling input but lacks direct support for streaming stdin continuously.

  2. Arguments (Args) and stdin: The traditional way of parsing command line options doesn't directly support piping input as arguments.

  3. Proposal for Enhancement:

    • Introduce an Arg combinator that can handle stdin as if it were an argument.
    • Consider using a symbol like - to indicate reading from stdin, mimicking conventions from other CLI tools.
    • Explore using Streams in conjunction with Args, allowing a stream from stdin to be treated as part of the argument parsing process.
  4. Challenges and Considerations:

    • Handling streaming input could potentially cause a program to hang if it waits indefinitely for input.
    • Designing a system where the application decides how to process the potentially streaming data.
  5. Implementation Ideas:

    • Introduce a method to declare Args that can incorporate stdin, possibly resulting in a Stream<string>.
    • Such features could be beneficial for processing command-line arguments intended to handle multiple inputs or streaming content.

The conversation involves contributions from several community members, considering both current limitations and potential enhancements to better handle piped input in CLI applications.

Discord thread

https://discord.com/channels/795981131316985866/1234796735730286654

@gcanti gcanti added the cli label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants