Skip to content

Commit

Permalink
Allow setting properties directly on opts() return value
Browse files Browse the repository at this point in the history
  • Loading branch information
aweebit committed Jul 30, 2023
1 parent 3cfd9b1 commit 88d0cf8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ class Command extends EventEmitter {
this._helpConfiguration = {};

this._optionValuesProxy = new Proxy(this._optionValues, {
set(_, key) {
throw new Error(`Tried to set value of option ${key} directly.
Use .setOptionValue() or .setOptionValueWithSource() instead`);
set: (_, key, value) => {
this.setOptionValue(key, value);
return true;
},
deleteProperty(_, key) {
deleteProperty: (_, key) => {
throw new Error(`Tried to delete value of option ${key}.
Option value deletion is not supported`);
},
defineProperty(_, key) {
defineProperty: (_, key) => {
throw new Error(`Tried to configure value of option ${key} using
- Object.defineProperty(),
- or Object.defineProperties(),
Expand Down

0 comments on commit 88d0cf8

Please sign in to comment.