Skip to content

Commit

Permalink
Merge pull request #856 from CleverCloud/davlgd-option-parsing-fix
Browse files Browse the repository at this point in the history
fix(addon): error with options parsing
  • Loading branch information
davlgd authored Nov 29, 2024
2 parents cf34f02 + 7005bbf commit cd9bf3d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import * as Application from './models/application.js';
import ISO8601 from 'iso8601-duration';
import Duration from 'duration-js';

const addonOptionsRegex = /^\w+=.+$/;
const addonOptionsRegex = /^[\w-]+=.+$/;

export function addonOptions (options) {
for (const option of options) {
const optionsArray = typeof options === 'string' ? [options] : options;
for (const option of optionsArray) {
if (!option.match(addonOptionsRegex)) {
return cliparse.parsers.error('Invalid option: ' + option);
}
}
return cliparse.parsers.success(options.join(','));
return cliparse.parsers.success(optionsArray.join(','));
}

export function flavor (flavor) {
Expand Down

0 comments on commit cd9bf3d

Please sign in to comment.