Skip to content

Commit

Permalink
feat(addon): elastic plugins option support
Browse files Browse the repository at this point in the history
  • Loading branch information
davlgd committed Nov 26, 2024
1 parent 4ecd4a3 commit 2ec8651
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/models/addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,14 @@ export function parseAddonOptions (options) {
return {};
}

return options.split(',').reduce((options, option) => {
const [key, value] = option.split('=');
const pairs = options.split(/,(?=\w+=)/) || [];

return pairs.reduce((options, pair) => {
const [key, ...valueParts] = pair.split('=');
const value = valueParts.join('=');

if (value == null) {
throw new Error("Options are malformed. Usage is '--option name=enabled|disabled|true|false'");
throw new Error("Options are malformed. Usage is '--option name=enabled|disabled|true|false|plugin1,plugin2'");
}

let formattedValue = value;
Expand Down

0 comments on commit 2ec8651

Please sign in to comment.