-
-
Notifications
You must be signed in to change notification settings - Fork 405
Description
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:
-
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. -
Arguments (
Args
) and stdin: The traditional way of parsing command line options doesn't directly support piping input as arguments. -
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 fromstdin
to be treated as part of the argument parsing process.
- Introduce an
-
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.
-
Implementation Ideas:
- Introduce a method to declare
Args
that can incorporate stdin, possibly resulting in aStream<string>
. - Such features could be beneficial for processing command-line arguments intended to handle multiple inputs or streaming content.
- Introduce a method to declare
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