This example
cli.table(users, {
name: {
minWidth: 7,
},
company: {
get: row => row.company && row.company.name
},
id: {
header: 'ID',
extended: true
}
}, {
printLine: this.log,
...flags, // parsed flags
})
doesn't match the signature table(data: any[], inputOptions?: Partial<TableOptions>)
npm update
makensis
. Would be a good idea to include it as a dependency or document it
@samuela Check out ( https://oclif.io/docs/hooks )
You can also create a custom hook that is invoked on each command you'd like it to run on.
Example:
class HelloCommand extends Command {
async run() {
// Custom Hook event (auth:github)
await this.config.runHook("auth:github");
const { flags } = this.parse(HelloCommand);
const name = flags.name || "world";
this.log(`hello ${name} from ./src/commands/hello.js`);
}
}
export default abstract class extends Command {
static flags = {
loglevel: flags.string({options: ['error', 'warn', 'info', 'debug']})
}
log(msg, level) {
switch (this.flags.loglevel) {
case 'error':
if (level === 'error') console.error(msg)
break
// a complete example would need to have all the levels
}
}
./bin/run foo < ./data/bar
process.stdin
Hi everyone, I've recently been hitting this error when running tests for our Oclif CLI:
(node:29441) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit
at _addListener (events.js:280:19)
at WriteStream.addListener (events.js:297:10)
at WriteStream.Readable.on (_stream_readable.js:772:35)
at Snapshot._swallowEPIPE (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:133:24)
at Snapshot.init (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:67:14)
at Snapshot._run (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:33:24)
at Function.Command.run (/Users/djones/Code/percy-agent/node_modules/@oclif/command/lib/command.js:155:16)
at <anonymous>
You can get the full backtrace there with --trace-warnings
turned on. And then after a wee bit of googling I noticed the Heroku CLI has actually been getting the same warnings recently https://ci.appveyor.com/project/heroku/heroku-cli-command/branch/master#L174
Has anyone seen this before? It seems to trace back to here https://github.com/oclif/command/blob/3c0bafd840b663f34286a9b1cb84aaee368a210d/src/command.ts#L178-L182
@oclif/command
and see if that fixes it.
@oclif/command
1.5.10 (which doesn't include PR #54 above) and the warning has gone.
npm install
. The IDE says no errors , but when I run ./bin/run
, it failes with MODULE_NOT_FOUND