Skip to content

Allow setting option init without default value#114

Merged
ntwcklng merged 1 commit into
leo:masterfrom
aapokiiso:init-function-without-default
Nov 28, 2017
Merged

Allow setting option init without default value#114
ntwcklng merged 1 commit into
leo:masterfrom
aapokiiso:init-function-without-default

Conversation

@aapokiiso

Copy link
Copy Markdown
Contributor

The init method didn't run when configuring an option without a default value, like this:

args
    .options([
        {
            name: 'theme',
            description: 'Build a specific theme in app/design',
            init: val => Array.isArray(val) ? val : [ val ], // Didn't run
        },
        {
            name: 'module',
            description: 'Build a specific module in app/code/local or vendor/',
            defaultValue: [],
            init: val => Array.isArray(val) ? val : [ val ], // Default value defined, runs correctly
        },
        ...
    ]);

I changed the logic slightly so that a default value is not required if you define an init method.

@ntwcklng

Copy link
Copy Markdown
Collaborator

LGTM, thanks!

@ntwcklng ntwcklng merged commit 3168f06 into leo:master Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants