Skip to content

Commit

Permalink
Add get() trap to option values proxy
Browse files Browse the repository at this point in the history
The goal is to always have consistent "get option value" behavior.

(cherry picked from commit a3f0e28)
  • Loading branch information
aweebit committed Aug 3, 2023
1 parent ef54142 commit 64dfafd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class Command extends EventEmitter {
this._helpConfiguration = {};

this._optionValuesProxy = new Proxy(this._optionValues, {
get: (_, key) => {
return this.getOptionValue(key);
},
set: (_, key, value) => {
this.setOptionValue(key, value);
return true;
Expand Down

0 comments on commit 64dfafd

Please sign in to comment.