Skip to content

Commit

Permalink
Fix syntax errors in migration example (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Feb 20, 2022
1 parent 47e8b20 commit 997655d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Expand Up @@ -281,14 +281,14 @@ program
.command('compress <filename>')
.option('-t, --trace')
// Old code before Commander 7
.action((filename, cmd)) => {
.action((filename, cmd) => {
if (cmd.trace) console.log(`Command name is ${cmd.name()}`);
});
```

```js
// New code
.action((filename, options, command)) => {
.action((filename, options, command) => {
if (options.trace) console.log(`Command name is ${command.name()}`);
});
```
Expand All @@ -301,14 +301,14 @@ program
.storeOptionsAsProperties(false)
.option('-t, --trace')
// Old code before Commander 7
.action((filename, command)) => {
.action((filename, command) => {
if (command.opts().trace) console.log(`Command name is ${command.name()}`);
});
```

```js
// New code
.action((filename, options, command)) => {
.action((filename, options, command) => {
if (command.opts().trace) console.log(`Command name is ${command.name()}`);
});
```
Expand Down

0 comments on commit 997655d

Please sign in to comment.