Skip to content

Commit

Permalink
Throw error on options-as-properties config after setting option values
Browse files Browse the repository at this point in the history
  • Loading branch information
aweebit committed Aug 2, 2023
1 parent 43c455f commit 20c7cfa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
*/

storeOptionsAsProperties(storeAsProperties = true) {
this._storeOptionsAsProperties = !!storeAsProperties;
if (this.options.length) {
throw new Error('call .storeOptionsAsProperties() before adding options');
}
if (Object.keys(this._optionValues).length) {
throw new Error('call .storeOptionsAsProperties() before setting option values');
}
this._storeOptionsAsProperties = !!storeAsProperties;
return this;
}

Expand Down

0 comments on commit 20c7cfa

Please sign in to comment.