Skip to content

Commit

Permalink
Improve shared subcommand error
Browse files Browse the repository at this point in the history

Co-authored-by: John Gee <john@ruru.gen.nz>
  • Loading branch information
aweebit and shadowspawn authored Jul 29, 2023
1 parent 0553d32 commit 55b9146
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ class Command extends EventEmitter {
- specify the name in Command constructor or using .name()`);
}
if (cmd.parent) {
throw new Error(`'${cmd._name}' cannot be added using .addCommand()
- it already has a parent command`);
throw new Error(`Command '${cmd.name()}' passed to .addCommand() already has a parent
- subcommands cannot be shared`);
}

opts = opts || {};
Expand Down

0 comments on commit 55b9146

Please sign in to comment.