Ora output is not written to stdout.txt:
node main.js sub show > stdout.txt
const cli = require('commander'); | |
const ora = require('ora'); | |
const sleep = ms => new Promise(res => setTimeout(res, ms)); | |
cli | |
.command('show') | |
.description('log some text to stdout') | |
.action(async (cmd) => { | |
await sleep(2000); | |
console.log('log text'); | |
ora().succeed('spinner text'); | |
}) | |
cli.parse(process.argv); |
const cli = require('commander'); | |
async function main() { | |
cli.command('sub', 'subcommand'); | |
cli.parse(process.argv); | |
} | |
main(); |
{ | |
"name": "cli-redirect", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"commander": "^2.15.1", | |
"ora": "^2.1.0" | |
} | |
} |