Skip to content

Commit

Permalink
Fix this.log.bind(this) (#883)
Browse files Browse the repository at this point in the history
This document is missing '. bind (this)'`, This can lead to the following errors:
```

TypeError: this.jsonEnabled is not a function
    at Object.log [as printLine] (/Users/user/xx-cli/node_modules/@oclif/core/lib/command.js:224:19)
    at Table.outputTable (/Users/user/xx-cli/node_modules/@oclif/core/lib/cli-ux/styled/table.js:244:21)
    at Table.display (/Users/user/xx-cli/node_modules/@oclif/core/lib/cli-ux/styled/table.js:137:22)
    at Object.table (/Users/user/xx-cli/node_modules/@oclif/core/lib/cli-ux/styled/table.js:301:39)
    at List.run (/Users/user/xx-cli/src/commands/list/index.ts:56:19)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async List._run (/Users/user/xx-cli/node_modules/@oclif/core/lib/command.js:304:22)
```
The official website is normal with the addition of '.bind(this)':
https://oclif.io/docs/table
  • Loading branch information
yantze authored Nov 29, 2023
1 parent b3d8731 commit bc8d87f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli-ux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export default class Users extends Command {
extended: true
}
}, {
printLine: this.log,
printLine: this.log.bind(this),
...flags, // parsed flags
})
}
Expand Down

0 comments on commit bc8d87f

Please sign in to comment.