Closed marcorivm closed 4 years ago
I have tried this on both cmd and Powershell
marco@DESKTOP D:\experiments\meow-cli $ node foo test [ 'test' ] marco@DESKTOP D:\experiments\meow-cli $ echo "test" | node foo []
This is the sample meow code I used, from the docs with the last line changed to log the cli input
#!/usr/bin/env node 'use strict'; const meow = require('meow'); const cli = meow(` Usage $ foo <input> Options --rainbow, -r Include a rainbow Examples $ foo unicorns --rainbow 🌈 unicorns 🌈 `, { flags: { rainbow: { type: 'boolean', alias: 'r' } } }); console.log(cli.input)
The expected behaviour would be recognizing the piped arguments like normal arguments.
I found this blog post https://www.exratione.com/2015/12/accepting-input-via-stdin-and-arguments-in-a-command-line-node-js-script/ with sample code which worked for me to get piped input parsed correctly on windows
@marcorivm You should use get-stdin instead. You could refer to here.
I have tried this on both cmd and Powershell
This is the sample meow code I used, from the docs with the last line changed to log the cli input
The expected behaviour would be recognizing the piped arguments like normal arguments.
I found this blog post https://www.exratione.com/2015/12/accepting-input-via-stdin-and-arguments-in-a-command-line-node-js-script/ with sample code which worked for me to get piped input parsed correctly on windows