Note, not reading, but handling when to read from stdin.
Currently it's this logic: https://github.com/sindresorhus/find-versions-cli/blob/56dbd77051147819abdf845504af3b3cc1dd2935/cli.js#L30-L41
The logic is, we only try to read from stdin when there's no input and process.isTTY === false
. Otherwise it won't work when used with child_process.execFile so the logic is hard to get right for many
if you only check isTTY, which i did with most of my CLIs previously, it wouldn't work with execFile, as isTTY is false there and it tries to read from stdin.
From hangouts chat:
Sindre: might consider handling reading stdin too, though not quite sure about that
maybe half of my CLIs read from stdin
Sam Verschueren: I would say "why not". But then again, it's an extra meow dependency
Sindre: extra deps doesn't matter that much since it's only used top-level by a CLI but the we can begin with the above. I want it separate anyways as some CLIs does streaming stdin reading which would require manual work anyways. so I'm thinking first a cli.stdinOrInput
and maybe at a later point we can do cli.stdin()
which makes use of the former.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too