posthtml / posthtml-cli

CLI for PostHTML
MIT License
29 stars 18 forks source link

Override config file options via CLI args #304

Closed giuseppeg closed 4 years ago

giuseppeg commented 4 years ago

I'd like to define my config in an external file but then allow the CLI args to override those options. Would you consider adding this feature (I could help with a PR)?

Scrum commented 4 years ago

@giuseppeg At the moment, CLI options have the highest priority over the config file, please describe the problem.

p.s. you can feel free about the PR :)

Scrum commented 4 years ago

Oh no, I think I saw that this is really not so https://github.com/posthtml/posthtml-cli/blob/343aa03f963b998999c2b417c3fbec5035bad046/src/cfg-resolve.js#L21-L26

the config goes last, which means that it has high priority. This is a mistake on my part and I will fix it as a minor so as not to break backward compatibility.

giuseppeg commented 4 years ago

@Scrum thanks for looking into this and no rush! When this is fixed will CLI options and config file be merged? Or if I provide CLI options the config file is ignored altogether?

This is a mistake on my part and I will fix it as a minor so as not to break backward compatibility.

Did you mean as a major?

giuseppeg commented 4 years ago

Did you mean as a major?

Oh nvm I didn't realize you were still at 0.x

Scrum commented 4 years ago

@Scrum thanks for looking into this and no rush! When this is fixed will CLI options and config file be merged? Or if I provide CLI options the config file is ignored altogether?

They are combined anyway, in order of priority, as I said earlier, the CLI will have the highest priority

Oh nvm I didn't realize you were still at 0.x

Yes, it is still developing, although it is already firmly

Scrum commented 4 years ago

@giuseppeg publish v0.7.0

giuseppeg commented 4 years ago

@Scrum that was quick! thanks a lot!